From de407e6ac0607c920832b62ef45c240cdef80a5c Mon Sep 17 00:00:00 2001 From: malle-pietje Date: Sun, 19 Aug 2018 12:13:53 +0200 Subject: [PATCH] cleanup of merge conflicts --- src/Client.php | 91 +++++++++++++++++++++++--------------------------- 1 file changed, 41 insertions(+), 50 deletions(-) diff --git a/src/Client.php b/src/Client.php index bc28ad2..e108638 100755 --- a/src/Client.php +++ b/src/Client.php @@ -784,18 +784,6 @@ class Client return $this->process_response($response); } - /** - * List user groups - * ---------------- - * returns an array of user group objects - */ - public function list_usergroups() - { - if (!$this->is_loggedin) return false; - $response = $this->exec_curl('/api/s/'.$this->site.'/list/usergroup'); - return $this->process_response($response); - } - /** * Assign client device to another group * ------------------------------------- @@ -811,6 +799,43 @@ class Client return $this->process_response_boolean($response); } + /** + * Update client fixedip (using REST) + * ------------------------------ + * returns an array containing a single object with attributes of the updated client on success + * required parameter = id of the client + * required parameter = boolean defining whether if use_fixedip is true or false + * optional parameter = network id where the ip belongs to + * optional parameter = value of client's fixed_ip field + * + */ + public function edit_client_fixedip($client_id, $use_fixedip, $network_id = null, $fixed_ip = null) + { + if (!$this->is_loggedin) return false; + if (!is_bool($use_fixedip)) return false; + $this->request_type = 'PUT'; + $data = ['_id' => $client_id, 'use_fixedip' => $use_fixedip]; + if($use_fixedip){ + if($network_id){ $data["network_id"] = $network_id; } + if($fixed_ip){ $data["fixed_ip"] = $fixed_ip; } + } + $json = json_encode($data); + $response = $this->exec_curl('/api/s/'.$this->site.'/rest/user/'.trim($client_id), $json); + return $this->process_response($response); + } + + /** + * List user groups + * ---------------- + * returns an array of user group objects + */ + public function list_usergroups() + { + if (!$this->is_loggedin) return false; + $response = $this->exec_curl('/api/s/'.$this->site.'/list/usergroup'); + return $this->process_response($response); + } + /** * Create user group (using REST) * --------------------------- @@ -829,7 +854,7 @@ class Client } /** - * Update user group (using REST) + * Modify user group (using REST) * ------------------------------ * returns an array containing a single object with attributes of the updated usergroup on success * required parameter = id of the user group @@ -837,7 +862,6 @@ class Client * required parameter = name of the user group * optional parameter = limit download bandwidth in Kbps (default = -1, which sets bandwidth to unlimited) * optional parameter = limit upload bandwidth in Kbps (default = -1, which sets bandwidth to unlimited) - * */ public function edit_usergroup($group_id, $site_id, $group_name, $group_dn = -1, $group_up = -1) { @@ -849,43 +873,10 @@ class Client } /** -<<<<<<< HEAD * Delete user group (using REST) * ------------------------------ * returns true on success * required parameter = id of the user group -======= - * Update client fixedip (using REST) - * ------------------------------ - * returns an array containing a single object with attributes of the updated client on success - * required parameter = id of the client - * required parameter = boolean defining whether if use_fixedip is true or false - * optional parameter = network id where the ip belongs to - * optional parameter = value of client's fixed_ip field - * - */ - public function edit_client_fixedip($client_id, $use_fixedip, $network_id = null, $fixed_ip = null) - { - if (!$this->is_loggedin) return false; - $this->request_type = 'PUT'; - $data = ['_id' => $client_id, 'use_fixedip' => $use_fixedip]; - if($use_fixedip){ - if($network_id){ $data["network_id"] = $network_id; } - if($fixed_ip){ $data["fixed_ip"] = $fixed_ip; } - } - $json = json_encode($data); - $response = $this->exec_curl('/api/s/'.$this->site.'/rest/user/'.trim($client_id), $json); - return $this->process_response($response); - } - - /** - * Create user group (using REST) - * --------------------------- - * returns an array containing a single object with attributes of the new usergroup ("_id", "name", "qos_rate_max_down", "qos_rate_max_up", "site_id") on success - * required parameter = name of the user group - * optional parameter = limit download bandwidth in Kbps (default = -1, which sets bandwidth to unlimited) - * optional parameter = limit upload bandwidth in Kbps (default = -1, which sets bandwidth to unlimited) ->>>>>>> 287c67c39e9480e0d2edc5635f9c2c820dedbe92 */ public function delete_usergroup($group_id) { @@ -927,7 +918,7 @@ class Client } /** - * Update firewall group (using REST) + * Modify firewall group (using REST) * ---------------------------------- * returns an array containing a single object with attributes of the updated firewall group on success * required parameter = _id value of the firewall group @@ -1876,9 +1867,9 @@ class Client * List network settings (using REST) * ---------------------------------- * returns an array of (non-wireless) networks and their settings - * optional parameter = string; network id to get specific network data + * optional parameter = string; network id to get specific network data for */ - public function list_networkconf($network_id = "") + public function list_networkconf($network_id = '') { if (!$this->is_loggedin) return false; $response = $this->exec_curl('/api/s/'.$this->site.'/rest/networkconf/'.trim($network_id));