Hi everybody,
I was wondering if exist any function to delete user directories through the REST service.
I can see in the documentation that exist the c_AddUserDirectory function wich allows me to manually add folders with proper permits but doesn't exist a delete user directory function.
How can I do that?
Thanks
Delete user directory through REST service
-
- Site Admin
- Posts: 2090
- Joined: Tue Sep 29, 2009 6:09 am
Re: Delete user directory through REST service
OK, you can do it like the below code, here we use PHP for calling the RESTful web service:
Code: Select all
<?php
$strUrl = "http://127.0.0.1:5466/admin_webservice.html";
$strUrlParam = "?admin=demo&pass=demo123&cmd=";
$strLuaScript = <<<EOT
local strDomain = "domain1"
local strUsername = "test"
local tableUser = c_GetUser(strDomain,strUsername)
for k,v in pairs(tableUser) do
if type(v) == "boolean" then
if v == true then
tableUser[k] = 1
else
tableUser[k] = 0
end
end
end
tableUser.oldpassword = tableUser.password
tableUser.directories = {}
AddUser(strDomain,tableUser)
EOT;
$strResult = file_get_contents($strUrl.$strUrlParam.rawurlencode($strLuaScript));
print($strResult);
?>
-
- Posts: 3
- Joined: Fri Feb 26, 2016 11:12 am
Re: Delete user directory through REST service
Hi FTP,
Thanks for your fast answer!!
Excuse me but I'm not an expert in Lua language and I have a doubt about the script.
What is "<<<EOT" and "EOT"?
Maybe they could be the quotation marks?
Something like this:
$strLuaScript = '
local strDomain = "domain1"
local strUsername = "test"
...
AddUser(strDomain,tableUser)
';
Thanks for your fast answer!!
Excuse me but I'm not an expert in Lua language and I have a doubt about the script.
What is "<<<EOT" and "EOT"?
Maybe they could be the quotation marks?
Something like this:
$strLuaScript = '
local strDomain = "domain1"
local strUsername = "test"
...
AddUser(strDomain,tableUser)
';
-
- Site Admin
- Posts: 2090
- Joined: Tue Sep 29, 2009 6:09 am
Re: Delete user directory through REST service
Yes, you are right, see this help document:
http://php.net/manual/en/language.types ... ax.heredoc" rel="nofollow
http://php.net/manual/en/language.types ... ax.heredoc" rel="nofollow
-
- Posts: 3
- Joined: Fri Feb 26, 2016 11:12 am
Re: Delete user directory through REST service
Hi FTP,
Thank you very much!!
The script is working fine except one thing:
when the script is executed, the user modified can't establish a ftp connection with the wing server. Seems like the password had been changed.
Could this be possible?
Thank you very much!!
The script is working fine except one thing:
when the script is executed, the user modified can't establish a ftp connection with the wing server. Seems like the password had been changed.
Could this be possible?
-
- Site Admin
- Posts: 2090
- Joined: Tue Sep 29, 2009 6:09 am
Re: Delete user directory through REST service
Just modified the above Lua script, please try it again.