
26th February 2010, 19:02
|
|
Junior Member
|
|
Join Date: Feb 2010
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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);
}
|

26th February 2010, 20:10
|
|
Banned
|
|
Join Date: Sep 2009
Posts: 132
Thanks: 10
Thanked 12 Times in 7 Posts
|
|
Quote:
Originally Posted by detot
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 20:21.
|

26th February 2010, 20:22
|
|
Senior Member
|
|
Join Date: Mar 2009
Location: Austria
Posts: 280
Thanks: 54
Thanked 84 Times in 51 Posts
|
|
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.
|

28th February 2010, 17:27
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,911
Thanks: 693
Thanked 4,198 Times in 3,213 Posts
|
|
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.
|

28th February 2010, 18:09
|
|
Senior Member
|
|
Join Date: Mar 2009
Location: Austria
Posts: 280
Thanks: 54
Thanked 84 Times in 51 Posts
|
|
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.
|

28th February 2010, 18:30
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,911
Thanks: 693
Thanked 4,198 Times in 3,213 Posts
|
|
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.
Last edited by till; 28th February 2010 at 18:44.
|

28th February 2010, 20:31
|
|
Junior Member
|
|
Join Date: Feb 2010
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by ivomendonca
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;
}
|
Thank you for answer, But your code is for LOCAL script, i mean it must be run only on server, there is ISPConfig, But im running my script from Remote server, hes connecting to ISPconfig, and adding null value.
|

28th February 2010, 21:45
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,911
Thanks: 693
Thanked 4,198 Times in 3,213 Posts
|
|
@detot: ivomendonca posted you the function stub from the server side so that you understand better how this works. These functions are exposed by a soap server, so the options for calling them remotely are identical.
|

8th April 2010, 14:43
|
|
Junior Member
|
|
Join Date: Jan 2009
Posts: 28
Thanks: 2
Thanked 9 Times in 6 Posts
|
|
I am in the process of writing some code using the remoting API and came across two functions that change the order of the arguments parsed.
mail_user_update($session_id, $client_id, $domain_id, $params)
AND
mail_fetchmail_update($session_id, $domain_id, $client_id, $params)
$domain_id and $client_id are sent in a different sequence and although this isn't strictly a bug it would be great to have this the same. In my case I am using one function to do all my remoting calls namely 'grud_record'. The function breaks with one of these functions depending which order I send. I haven't checked for other differences.
|

8th April 2010, 19:37
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,911
Thanks: 693
Thanked 4,198 Times in 3,213 Posts
|
|
The parameters should be consistent of course. Please add this to the bugtracker and we will review this.
|
| Thread Tools |
|
|
| Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 01:43.
|
Recent comments
1 day 21 min ago
1 day 5 hours ago
1 day 9 hours ago
1 day 11 hours ago
2 days 1 hour ago
2 days 1 hour ago
2 days 6 hours ago
2 days 13 hours ago
2 days 14 hours ago
2 days 15 hours ago