public grantRole ( $role, $rolename, $admin ) | ||
$role | The name of the target role | |
$rolename | The name of the role that will belong to the target role | |
$admin | (optional) Flag to grant the admin option |
function grantRole($role, $rolename, $admin = 0)
{
$this->fieldClean($role);
$this->fieldClean($rolename);
$sql = "GRANT \"{$role}\" TO \"{$rolename}\"";
if ($admin == 1) {
$sql .= ' WITH ADMIN OPTION';
}
return $this->execute($sql);
}