Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Developers' Forum

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 26th February 2010, 20:02
detot detot is offline
Junior Member
 
Join Date: Feb 2010
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default remote framework

Im looking for remote framework using scripts for ISPconfig.
I have ISPConfig 3.
But in core there are only mail_ functions.
Im understanding, that its not hard to write new function, but if you have examples for ISPconfig3, Ill be very happy... =)))

And another one problem:
Im trying to add mail_domain,
After running this function from remote script, i see domain, but without any name, client_id and activity.

That im doing not right?

$params = array ( 'sid' => $session_id,
'module' => 'mail',
'function' => 'mail_domain',
'params' => array ( "domain" => 'test1.com',
"active" => 'y',
"server_id" => '1'
));
$domain_id = $soap_client->call('mail_domain_add', $params);
if($err = $soap_client->getError()){
die("Error: ".$err);
}else{
print_r($domain_id);
}
Reply With Quote
Sponsored Links
  #2  
Old 26th February 2010, 21:10
ivomendonca ivomendonca is offline
Banned
 
Join Date: Sep 2009
Posts: 132
Thanks: 10
Thanked 14 Times in 8 Posts
Default

Quote:
Originally Posted by detot View Post
Im looking for remote framework using scripts for ISPconfig.
I have ISPConfig 3.
But in core there are only mail_ functions.
Im understanding, that its not hard to write new function, but if you have examples for ISPconfig3, Ill be very happy... =)))

And another one problem:
Im trying to add mail_domain,
After running this function from remote script, i see domain, but without any name, client_id and activity.

That im doing not right?

$params = array ( 'sid' => $session_id,
'module' => 'mail',
'function' => 'mail_domain',
'params' => array ( "domain" => 'test1.com',
"active" => 'y',
"server_id" => '1'
));
$domain_id = $soap_client->call('mail_domain_add', $params);
if($err = $soap_client->getError()){
die("Error: ".$err);
}else{
print_r($domain_id);
}

You only have to know the client_id for adding or 0 for admin owner.
hope to help





//* Add a mail domain
public function mail_domain_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'mail_domain_add')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$domain_id = $this->insertQuery('../mail/form/mail_domain.tform.php',$client_id,$params);
return $domain_id;
}

Last edited by ivomendonca; 26th February 2010 at 21:21.
Reply With Quote
  #3  
Old 26th February 2010, 21:22
Horfic Horfic is offline
Senior Member
 
Join Date: Mar 2009
Location: Austria
Posts: 325
Thanks: 55
Thanked 95 Times in 60 Posts
Send a message via Skype™ to Horfic
Default

Acutally with the 3.0.2 the remote framework will be complete.
Instead of knowing the client_id you have to know now the sysuser_id.
__________________
web wack creations - We create your custom web application
Mailuser interface for ISPConfig 3
Reply With Quote
  #4  
Old 28th February 2010, 18:27
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 36,796
Thanks: 840
Thanked 5,612 Times in 4,423 Posts
Default

There seems to be a bug in this function, as it should be the client ID and not sysuser_id (the variable is named also client_id). The sysuser_id is only for ispconfigs internal use and should not be exposed in the api especially as the api does not offer a function to retrieve this ID and the sysuser id is not unique for a client as there might be more then one sysuser for a client. I will see how this can be corrected until the release of 3.0.2 so that the client_id is used in all functions.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 28th February 2010, 19:09
Horfic Horfic is offline
Senior Member
 
Join Date: Mar 2009
Location: Austria
Posts: 325
Thanks: 55
Thanked 95 Times in 60 Posts
Send a message via Skype™ to Horfic
Default

Actually we changed that, because you couldn't get the client id from the e.g. the mailbox, only the sysuser_id and when the sysuser wasn't the main sysuser of a client, the error appeared that there was no client user found. So we changed it. I asked you, if you remember.
__________________
web wack creations - We create your custom web application
Mailuser interface for ISPConfig 3
Reply With Quote
  #6  
Old 28th February 2010, 19:30
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 36,796
Thanks: 840
Thanked 5,612 Times in 4,423 Posts
Default

I thought the change was only that the function will work even if no client ID id was set (set 0 (admin) as default in this case). I will review the code again. But we will have to change it back to client_id if it was changed to sysuser ID.

By the way, the current ISPConfig does not support to add additionaly sysusers for a client as the information about the underlying client can not be set trough the interface, at the moment it is only allowed to add additional admin users. As you see in the SVN version, there has a warning be added now to not try to add sysusers as they can not work (not only in the api, they will not work in the normal web interface as well as all records created by such a user will be invalid and you get a permission error then).

Sorry about the misunderstanding, but using the sysuserid in the api instead of client ID is not an option.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.

Last edited by till; 28th February 2010 at 19:44.
Reply With Quote
  #7  
Old 28th February 2010, 19:41
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 36,796
Thanks: 840
Thanked 5,612 Times in 4,423 Posts
Default

I've just checked the code, the reason that it did not work was a wrong fieldname in the SQL query. The original query was:

SELECT * FROM sys_user WHERE sysuser_id = $client_id

but there is no column sysuser_id in that table. The correct query is:

SELECT * FROM sys_user WHERE client_id = $client_id

so the loading of sysuser details for a specific client_id will work now.

As a solution for for looking up a client_id, I think we can either

a) add a lookup function to the API for it or
b) we return the client ID automatically in the array that the *_get functions return.

Which option would you prefer?
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #8  
Old 28th February 2010, 19:46
Horfic Horfic is offline
Senior Member
 
Join Date: Mar 2009
Location: Austria
Posts: 325
Thanks: 55
Thanked 95 Times in 60 Posts
Send a message via Skype™ to Horfic
Default

But then I would like to have a function to get the client id from the appropiate mailbox, domain, etc.
__________________
web wack creations - We create your custom web application
Mailuser interface for ISPConfig 3
Reply With Quote
  #9  
Old 28th February 2010, 19:53
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 36,796
Thanks: 840
Thanked 5,612 Times in 4,423 Posts
Default

That should not be a problem. I will add a function like:

get_client_id($sysuser_id);

I will add this tomorrow and upload it to svn.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #10  
Old 28th February 2010, 20:06
Horfic Horfic is offline
Senior Member
 
Join Date: Mar 2009
Location: Austria
Posts: 325
Thanks: 55
Thanked 95 Times in 60 Posts
Send a message via Skype™ to Horfic
 
Default

then i will rewrite my plugins for that.
__________________
web wack creations - We create your custom web application
Mailuser interface for ISPConfig 3
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Remote Framework - Client Add - Ispconfig 3 Germanius General 5 23rd December 2009 19:16
Remote Framework not working lrider General 1 16th October 2009 10:10
remote framework - is it customer or admin side? alipanick Developers' Forum 2 8th October 2009 21:35
Remote Framework Help? AceP1983 General 1 7th June 2009 02:13
Remote Framework Horfic General 8 23rd May 2009 10:29


All times are GMT +2. The time now is 06:36.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.