From 9d417c0df251bee77b02d7275421f16434c0f1f2 Mon Sep 17 00:00:00 2001 From: Till Brehm Date: Tue, 8 Jan 2019 12:07:43 +0100 Subject: [PATCH] Implements new API functions #5215 and #5202 --- interface/lib/classes/remote.d/admin.inc.php | 43 +++++++++++++++++++ interface/lib/classes/remote.d/client.inc.php | 21 +++++++++ interface/lib/classes/remote.d/dns.inc.php | 15 +++++++ .../API-docs/client_get_by_groupid.html | 29 +++++++++++++ .../API-docs/dns_slave_delete.html | 29 +++++++++++++ remoting_client/API-docs/dns_slave_get.html | 29 +++++++++++++ remoting_client/API-docs/sys_datalog_get.html | 29 +++++++++++++ .../API-docs/sys_datalog_get_by_tstamp.html | 29 +++++++++++++ 8 files changed, 224 insertions(+) create mode 100644 remoting_client/API-docs/client_get_by_groupid.html create mode 100644 remoting_client/API-docs/dns_slave_delete.html create mode 100644 remoting_client/API-docs/dns_slave_get.html create mode 100644 remoting_client/API-docs/sys_datalog_get.html create mode 100644 remoting_client/API-docs/sys_datalog_get_by_tstamp.html diff --git a/interface/lib/classes/remote.d/admin.inc.php b/interface/lib/classes/remote.d/admin.inc.php index 8b0c4730e8..793f9ed339 100644 --- a/interface/lib/classes/remote.d/admin.inc.php +++ b/interface/lib/classes/remote.d/admin.inc.php @@ -272,6 +272,49 @@ class remoting_admin extends remoting { return $app->db->query('DELETE FROM sys_config WHERE `group` = ? AND `name` = ?',$group,$name); } + + // Get datalog information with tstamp >= + public function sys_datalog_get_by_tstamp($session_id, $tstamp) + { + global $app; + + if(!$this->checkPerm($session_id, 'server_get')) { + throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + $tstamp = $app->functions->intval($tstamp); + + if($tstamp > 0) { + $rec = $app->db->queryAllRecords("SELECT datalog_id, server_id, dbtable, dbidx, action, tstamp, user, data, status, error FROM sys_datalog WHERE tstamp >= ? ORDER BY datalog_id DESC", $tstamp); + return $rec; + } + } + + // Get datalog information by datalog_id + public function sys_datalog_get($session_id, $datalog_id, $newer = false) + { + global $app; + + if(!$this->checkPerm($session_id, 'server_get')) { + throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + $tstamp = $app->functions->intval($tstamp); + + if($datalog_id > 0 && $newer === true) { + $rec = $app->db->queryAllRecords("SELECT datalog_id, server_id, dbtable, dbidx, action, tstamp, user, data, status, error FROM sys_datalog WHERE datalog_id >= ? ORDER BY datalog_id DESC", $datalog_id); + return $rec; + } elseif ($datalog_id > 0) { + $rec = $app->db->queryAllRecords("SELECT datalog_id, server_id, dbtable, dbidx, action, tstamp, user, data, status, error FROM sys_datalog WHERE datalog_id = ? ORDER BY datalog_id DESC", $datalog_id); + return $rec; + } else { + throw new SoapFault('invalid_datalog_id', 'The ID passed to the function must be > 0'); + return false; + } + } + } diff --git a/interface/lib/classes/remote.d/client.inc.php b/interface/lib/classes/remote.d/client.inc.php index 5c47c26c76..b91909c9d3 100644 --- a/interface/lib/classes/remote.d/client.inc.php +++ b/interface/lib/classes/remote.d/client.inc.php @@ -678,6 +678,27 @@ class remoting_client extends remoting { return $returnval; } + + public function client_get_by_groupid($session_id, $group_id) + { + global $app; + if(!$this->checkPerm($session_id, 'client_get_id')) { + throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + $group_id = $app->functions->intval($group_id); + + $rec = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ?", $group_id); + if(isset($rec['client_id'])) { + $client_id = $app->functions->intval($rec['client_id']); + return $this->client_get($session_id, $client_id); + } else { + throw new SoapFault('no_group_found', 'There is no client for this group ID.'); + return false; + } + } + } ?> diff --git a/interface/lib/classes/remote.d/dns.inc.php b/interface/lib/classes/remote.d/dns.inc.php index 363af8f480..faae06dc2e 100644 --- a/interface/lib/classes/remote.d/dns.inc.php +++ b/interface/lib/classes/remote.d/dns.inc.php @@ -197,6 +197,21 @@ class remoting_dns extends remoting { return $app->remoting_lib->getDataRecord($primary_id); } + //* Get slave zone details + public function dns_slave_get($session_id, $primary_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'dns_zone_get')) { + throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../dns/form/dns_slave.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a slave zone public function dns_slave_add($session_id, $client_id, $params) { diff --git a/remoting_client/API-docs/client_get_by_groupid.html b/remoting_client/API-docs/client_get_by_groupid.html new file mode 100644 index 0000000000..60fb58e474 --- /dev/null +++ b/remoting_client/API-docs/client_get_by_groupid.html @@ -0,0 +1,29 @@ + +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

client_get_by_groupid($session_id, $groupid);

+
+

Description:

+

Shows client information of user.


+

Input Variables:

+

$session_id, $groupid

+

Parameters (in $params):

+

None

+

Output:

+

Returns client information from client tyble by groupid of that client.

+ +
+ + diff --git a/remoting_client/API-docs/dns_slave_delete.html b/remoting_client/API-docs/dns_slave_delete.html new file mode 100644 index 0000000000..baaca8408e --- /dev/null +++ b/remoting_client/API-docs/dns_slave_delete.html @@ -0,0 +1,29 @@ + +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

dns_slave_delete($session_id, $primary_id);

+
+

Description:

+

Deletes a dns slave zone.


+

Input Variables:

+

$session_id, $primary_id

+

Parameters (in $params):

+

None

+

Output:

+

Returns the number of deleted records.

+ +
+ + diff --git a/remoting_client/API-docs/dns_slave_get.html b/remoting_client/API-docs/dns_slave_get.html new file mode 100644 index 0000000000..8b66dd3006 --- /dev/null +++ b/remoting_client/API-docs/dns_slave_get.html @@ -0,0 +1,29 @@ + +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

dns_slave_get($session_id, $primary_id);

+
+

Description:

+

Retrieves information about a dns slave zone.


+

Input Variables:

+

$session_id, $primary_id

+

Parameters (in $params):

+

None

+

Output:

+

Returns all fields and values of the chosen dns slave zone.

+ +
+ + diff --git a/remoting_client/API-docs/sys_datalog_get.html b/remoting_client/API-docs/sys_datalog_get.html new file mode 100644 index 0000000000..9f17146090 --- /dev/null +++ b/remoting_client/API-docs/sys_datalog_get.html @@ -0,0 +1,29 @@ + +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

sys_datalog_get($session_id, $datalog_id, $newer);

+
+

Description:

+

Retrieves information from sys_datalog.


+

Input Variables:

+

$session_id, $datalog_id, $newer (true/false)

+

Parameters (in $params):

+

None

+

Output:

+

Returns all fields and values of the chosen dns slave zone.

+ +
+ + diff --git a/remoting_client/API-docs/sys_datalog_get_by_tstamp.html b/remoting_client/API-docs/sys_datalog_get_by_tstamp.html new file mode 100644 index 0000000000..fdc1008c21 --- /dev/null +++ b/remoting_client/API-docs/sys_datalog_get_by_tstamp.html @@ -0,0 +1,29 @@ + +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

sys_datalog_get_by_tstamp($session_id, $tstamp);

+
+

Description:

+

Retrieves information from sys_datalog by timestamp. All records that are newer or same than given timestamp are returned.


+

Input Variables:

+

$session_id, $tstamp

+

Parameters (in $params):

+

None

+

Output:

+

Returns all fields and values of the chosen dns slave zone.

+ +
+ + -- GitLab