Suggestion: checkUserAlias function

Post here if you have some suggestions or you want to request a new feature.
Post Reply
Peter
Posts: 3
Joined: Tue Aug 09, 2011 8:28 am

Suggestion: checkUserAlias function

Post by Peter »

Hi there

Currently, there is a useful c_AddUserDirectory LUA function which works well for adding alias folders.

The problem is that there is no way to check if the user already has an alias folder, so if you add another alias with the same alias it will let you.

Could we have a c_CheckUserAlias function to check if the user already has a folder alias in their account? Or is there another way in LUA that this can be checked?
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Suggestion: checkUserAlias function

Post by FTP »

It is hard to check, because the same alias name with different permissions will be allowed. But you can use the following script to check whether the specified virtual directory existed:

Code: Select all

local user = c_GetUser("DomainName","UserName")
local directories = user["directories"]

if directories ~= nil then
 for _,directory in pairs(directories) do
    if directory.alias == "YourAliasName" then
	break
    end
 end
end
Post Reply