Permissions

Saturn has a built-in permissions system, it's designed to work with the Control Panel plugin, but will work for any other control-panel-esque as well.

Check if the user has a certain permission.

use Saturn\AccountManager\Permissions;

$Permissions = new Permissions($_SESSION['uuid']);
if ($Permissions->HasPermission(['administrator','panel_access'],'OR')) {
    // User is an administrator, or has the panel_access permission.
} else {
    // User is not an administrator.
    // They also don't have the panel_access permission.
}

Fetch a list of the user's permissions.

use Saturn\AccountManager\Permissions;

$Permissions = new Permissions($_SESSION['uuid']);

// All the user's permissions in JSON object format.
$UserPermissions = $Permissions->Permissions;

Last updated