Page 1 of 1

Need a c_ModifyUserDirectory

Posted: Wed Mar 22, 2023 5:12 pm
by StenAaboHansen
I need to change my users access to creating directory and try doing it by adding the directory again without success. I get another line in the interface.

How to do ?

Re: Need a c_ModifyUserDirectory

Posted: Thu Mar 23, 2023 1:56 am
by FTP
What do you mean? Just change the existing home folder to a new folder path, and keep the same folder permissions? If so, you can take the following script:

Code: Select all

local domain = "YourDomainName"
local username = "YourUserName"
local newFolder = "d:/testfolder/"

local user = c_GetUser(domain, username)
for k,v in pairs(user) do
	if type(v) == "boolean" then
		if v == true then
			user[k] = 1
		else
			user[k] = 0
		end
	end
end

if type(user.directories) == "table" then
	user.directories[1].dir = newFolder
end

user.oldpassword = user.password
AddUser(domain, user)