View Full Version : Hook after user creation?
michal
12-24-2011, 05:59 PM
Hello,
is there any way how to hook a (shell) script to the ISPmanager in such a way that it would be called right after a user is created? I had no luck finding it.
Actually I need the same for domain creation too.
Any help is really appreciated. Thank you! :)
slava
12-25-2011, 12:34 AM
Hello, see
http://en.ispdoc.com/index.php/Performing_custom_operations
http://en.ispdoc.com/index.php/Events
Use event for user.edit and domain.edit
michal
12-26-2011, 04:39 PM
Hello, see
http://en.ispdoc.com/index.php/Performing_custom_operations
http://en.ispdoc.com/index.php/Events
Use event for user.edit and domain.edit
This is exactly what I needed, thank you!
However it seems that I am unable to get it working. What I have done (following the first link):
# cat /usr/local/ispmgr/etc/ispmgr_mod_perms.xml
<?xml version="1.0" encoding="UTF-8"?>
<mgrdata>
<handler name="perms_user.pl" type="cgi">
<event after="yes">user.edit</event>
</handler>
</mgrdata>
# cat /usr/local/ispmgr/addon/perms_user.pl
#!/usr/bin/perl
use CGI;
my $Q = new CGI;
$func = $Q->param("func");
$elid = $Q->param("elid");
if ($func eq "user.edit") {
if ($Q->param("sok") && $elid eq "") {
# a user is created
$name = $Q->param("name");
#system("/usr/local/sbin/setperms_user.sh $name");
}
}
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<doc/>\n";
(I commented out the "system" command just to make sure it doesn't negatively affect the result.)
And permissions:
-r-xr-x--- 1 root root 354 Dec 26 13:44 /usr/local/ispmgr/addon/perms_user.pl
-rw-r--r-- 1 root root 158 Dec 26 13:33 /usr/local/ispmgr/etc/ispmgr_mod_perms.xml
And of course I restarted the ISPmanager. What I get when I now click on "Create user" button, is usual form, but with error message "malformed result" (filling the form and sending it results in the same error). I failed with bash script (ISPmanager was waiting and waiting and didn't show the form) so I decided to follow the guide as close as possible, but it doesn't work. I am doing something wrong?
I'm working with ISPmanager-Pro 4.3.53.1.
Have you tried to run the script manually? Something like 'perl perms_user.pl'
michal
12-27-2011, 03:27 PM
Have you tried to run the script manually? Something like 'perl perms_user.pl'
Oh, there were some illegal characters on those empty lines. Good tip.
Thank you for helping me, vian and slava!
vBulletin® v3.8.9, Copyright ©2000-2024, vBulletin Solutions, Inc.