FYI : i had to upgrade https://github.com/skeyby/sag just a little bit,
adding the following to src/Sag.php :
public function setAdmins($data) {
return $this->procPacket ('PUT', '/'.$this->db.'/_security', $data);
}
this is intended to be used as such :
$cdb = new Sag($cdbConfig['domain'], $cdbConfig['port']);
$cdb->setHTTPAdapter($cdbConfig['httpAdapter']);
$cdb->useSSL($cdbConfig['useSSL']);
$cdb->login($cdbConfig['adminUsername'], $cdbConfig['adminPassword']);
$cdb->setDatabase($cms->domain.'___analytics',true);
$json = '{ "admins": { "names": [], "roles": ["guests"] }, "members": {
"names": ["Administrator"], "roles": ["guests"] } }';
try {
$call = $cdb->setAdmins ($json);
} catch (Exception $e) {
echo '<pre style="color:red">'; var_dump ($e); echo '</pre>'; die();
}
echo 'Created database '.$cms->domain.'___analytics<br/>';