Add grant_super_admin method (#272)

* Add is_super to update_admin method

* Add grant_super_admin method
This commit is contained in:
Jacob Timmerman
2025-06-11 14:09:21 +02:00
committed by GitHub
parent 2cc60dbc3c
commit 8b5992979c

View File

@@ -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.
*