From 8b5992979c43236e2308fd7d0ee133b9bc167061 Mon Sep 17 00:00:00 2001 From: Jacob Timmerman <75219092+Jacobtims@users.noreply.github.com> Date: Wed, 11 Jun 2025 14:09:21 +0200 Subject: [PATCH] Add grant_super_admin method (#272) * Add is_super to update_admin method * Add grant_super_admin method --- src/Client.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index 5a26180..e20443f 100755 --- a/src/Client.php +++ b/src/Client.php @@ -2045,7 +2045,8 @@ class Client string $password = '', bool $readonly = false, bool $device_adopt = false, - bool $device_restart = false + bool $device_restart = false, + bool $is_super = null ): bool { $email = trim($email); @@ -2076,6 +2077,10 @@ class Client $payload['permissions'][] = 'API_DEVICE_RESTART'; } + if ($is_super) { + $payload['is_super'] = $is_super; + } + return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/sitemgr', $payload); } @@ -2111,6 +2116,21 @@ class Client return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/sitemgr', $payload); } + /** + * Grant an admin super admin + * + * @param string $admin_id _id value of the admin to grant super admin, can be obtained using the + * list_all_admins() method/function + * @return bool true on success + * @throws Exception + */ + public function grant_super_admin(string $admin_id): bool + { + $payload = ['cmd' => 'grant-super-admin', 'admin' => $admin_id]; + + return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/sitemgr', $payload); + } + /** * Fetch WLAN groups. *