US: 1-941-4621-069
  
Cyprus: 3-572-2052-781

Go Back   ISPsystem.com Forums > ISPmanager > General technical discussion


Reply
 
Thread Tools
Old 12-24-2011, 05:59 PM   #1
Junior Member
 
Join Date: Dec 2011
Posts: 3
michal is on a distinguished road
Default Hook after user creation?

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!
michal is offline   Reply With Quote
Old 12-25-2011, 12:34 AM   #2
ISPsystem team
 
slava's Avatar
 
Join Date: May 2008
Location: ISPsystem
Posts: 588
slava is on a distinguished road
Default

Hello, see
http://en.ispdoc.com/index.php/Perfo...tom_operations
http://en.ispdoc.com/index.php/Events

Use event for user.edit and domain.edit
slava is offline   Reply With Quote
Old 12-26-2011, 04:39 PM   #3
Junior Member
 
Join Date: Dec 2011
Posts: 3
michal is on a distinguished road
Default

Quote:
Originally Posted by slava View Post
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):

Code:
# 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>
Code:
# 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:
Code:
-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.
michal is offline   Reply With Quote
Old 12-27-2011, 03:53 AM   #4
ISPsystem team
 
Join Date: Oct 2009
Posts: 118
vian is on a distinguished road
Default

Have you tried to run the script manually? Something like 'perl perms_user.pl'
vian is offline   Reply With Quote
Old 12-27-2011, 03:27 PM   #5
Junior Member
 
Join Date: Dec 2011
Posts: 3
michal is on a distinguished road
Default

Quote:
Originally Posted by vian View Post
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!
michal is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:05 AM.