diff --git a/interface/lib/classes/remote.d/domains.inc.php b/interface/lib/classes/remote.d/domains.inc.php index 33830335d8989990cd1c4f4613ab290679763184..05a639ad6e20f287806c8f395d1ae94d6e5eb422 100644 --- a/interface/lib/classes/remote.d/domains.inc.php +++ b/interface/lib/classes/remote.d/domains.inc.php @@ -65,6 +65,16 @@ class remoting_domains extends remoting { return $this->insertQuery('../client/form/domain.tform.php', $client_id, $params); } + //* Update a record + public function domains_domain_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'domains_domain_update')) { + throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->updateQuery('../client/form/domain.tform.php', $client_id, $primary_id, $params); + } + //* Delete a record public function domains_domain_delete($session_id, $primary_id) { diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php index fe8b1694c404de7f3382ef89060bb8435c56d6d6..6e551355a690536aa8e938395c110476914ceb3d 100644 --- a/interface/lib/classes/remoting.inc.php +++ b/interface/lib/classes/remoting.inc.php @@ -383,7 +383,7 @@ class remoting { $app->remoting_lib->loadFormDef($formdef_file); //* get old record and merge with params, so only new values have to be set in $params - $old_rec = $app->remoting_lib->getDataRecord($primary_id); + $old_rec = $app->remoting_lib->getDataRecord($primary_id, $client_id); foreach ($app->remoting_lib->formDef['fields'] as $fieldName => $fieldConf) { diff --git a/interface/lib/classes/remoting_lib.inc.php b/interface/lib/classes/remoting_lib.inc.php index a5a5d0c31c49c647f33d5a0eca3310133820e05c..62ccd506c889002cc99066e8f68ed7998d93528c 100644 --- a/interface/lib/classes/remoting_lib.inc.php +++ b/interface/lib/classes/remoting_lib.inc.php @@ -225,10 +225,10 @@ class remoting_lib extends tform_base { return $sql; } - function getDataRecord($primary_id) { + function getDataRecord($primary_id, $client_id = 0) { global $app; $escape = '`'; - $this->loadUserProfile(); + $this->loadUserProfile($client_id); if(@is_numeric($primary_id)) { if($primary_id > 0) { // Return a single record diff --git a/interface/lib/classes/tform_base.inc.php b/interface/lib/classes/tform_base.inc.php index 3dc9edacc18b10f87fe8befba9d6d3252ee7b2ba..36de1371ab25fabe07d908f431ce8bb9016a8833 100644 --- a/interface/lib/classes/tform_base.inc.php +++ b/interface/lib/classes/tform_base.inc.php @@ -1384,7 +1384,7 @@ class tform_base { } else { if($this->formDef['auth'] == 'yes') { if($primary_id != 0) { - if($api == true && $_SESSION["s"]["user"]["client_id"] > 0 && $_SESSION["s"]["user"]["iserid"] > 0 && $_SESSION["s"]["user"]["default_group"] > 0) { + if($api == true && $_SESSION["s"]["user"]["client_id"] > 0 && $_SESSION["s"]["user"]["userid"] > 0 && $_SESSION["s"]["user"]["default_group"] > 0) { $sql_update .= '`sys_userid` = '.$this->sys_userid.', '; $sql_update .= '`sys_groupid` = '.$this->sys_default_group.', '; } diff --git a/interface/web/client/lib/remote.conf.php b/interface/web/client/lib/remote.conf.php index d58029e8513ad78a26ca2abfa783ec41d70bfea8..0c2449b93901911b18098b4e2627e8ddedfc3a75 100644 --- a/interface/web/client/lib/remote.conf.php +++ b/interface/web/client/lib/remote.conf.php @@ -1,7 +1,7 @@ +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

domains_domain_update($session_id, $client_id, $primary_id, $params);

+
+

Description:

+

Updates domain to move it to another client.


+

Input Variables:

+

$session_id, $client_id, $primary_id, $params

+

Parameters (in $params):

+

domain  (varchar(255))

+

client_id  (int(11))

+

Output:

+

Returns the number of affected rows.

+ +
+ + diff --git a/remoting_client/examples/domains_domain_update.php b/remoting_client/examples/domains_domain_update.php new file mode 100644 index 0000000000000000000000000000000000000000..244222428c773097a4d6c98f9dafef48035d1e47 --- /dev/null +++ b/remoting_client/examples/domains_domain_update.php @@ -0,0 +1,39 @@ + $soap_location, + 'uri' => $soap_uri, + 'trace' => 1, + 'exceptions' => 1)); + + +try { + if($session_id = $client->login($username, $password)) { + echo 'Logged successfull. Session ID:'.$session_id.'
'; + } + + //* Set the function parameters. + $client_id = 1; + $primary_id = 42; // The domain_id + $params = array( + 'domain' => 'cellar.door' + ); + + $result = $client->domains_domain_update($session_id, $client_id, $primary_id, $params); + + if ($result) { + echo 'Domain updated.
'; + } + if ($client->logout($session_id)) { + echo 'Logged out.
'; + } + + +} catch (SoapFault $e) { + echo $client->__getLastResponse(); + die('SOAP Error: '.$e->getMessage()); +} + +?>