|
static | getAllRoles (bool $grouped=false) |
|
static | getRoleIdByName ($name) |
|
static | saveRole ($role) |
|
static | deleteRole ($role) |
|
static | deleteRoleByName (string $role_name) |
|
static | assignRole (User $user, $role, $institut_id='') |
|
static | assignRoleToPerm (string $perm, Role $role) |
|
static | getAssignedRoles ($user_id, $implicit=false) |
|
static | getAssignedRoleInstitutes ($user_id, $role_id) |
|
static | isAssignedRole ($userid, $assignedrole, $institut_id='') |
|
static | deleteRoleAssignment (User $user, $role, $institut_id=null) |
|
static | deleteRoleAssignmentFromPerm (string $perm, Role $role) |
|
static | getAllRoleAssignments ($user=null) |
|
static | assignPluginRoles ($plugin_id, $role_ids) |
|
static | deleteAssignedPluginRoles ($plugin_id, $role_ids) |
|
static | getAssignedPluginRoles ($plugin_id) |
|
static | getUsersWithRoleByName (string $role_name, bool $only_explicit=true) |
|
static | getUsersWithRoleById (int $role_id, bool $only_explicit=true) |
|
static | getStatistics () |
|
static | countImplicitUsers ($role_id) |
|
static | expireRolesCache () |
|
static | expireUserCache ($user_id=null) |
|
static | expirePluginCache ($plugin_id=null) |
|
static | expireCaches () |
|
◆ assignPluginRoles()
static assignPluginRoles |
( |
|
$plugin_id, |
|
|
|
$role_ids |
|
) |
| |
|
static |
Enter description here...
- Parameters
-
int | $pluginid | |
array | $roleids | |
◆ assignRole()
static assignRole |
( |
User |
$user, |
|
|
|
$role, |
|
|
|
$institut_id = '' |
|
) |
| |
|
static |
Saves a role assignment to the database
- Parameters
-
◆ assignRoleToPerm()
static assignRoleToPerm |
( |
string |
$perm, |
|
|
Role |
$role |
|
) |
| |
|
static |
Assigns a role to a stud.ip permission. System roles cannot be assigned to permissions.
- Parameters
-
- Returns
- bool
- Exceptions
-
◆ countImplicitUsers()
static countImplicitUsers |
( |
|
$role_id | ) |
|
|
static |
Counts the implicitely assigned users for a role.
- Parameters
-
mixed | $role_id | Role id or array of role ids |
- Returns
- mixed number of implictit for the role (if one role id is given) or associative array [role id => number of implicit users] when given a list of role ids
◆ deleteAssignedPluginRoles()
static deleteAssignedPluginRoles |
( |
|
$plugin_id, |
|
|
|
$role_ids |
|
) |
| |
|
static |
Removes the given roles' assignments from the given plugin.
- Parameters
-
int | $pluginid | |
array | $roleids | |
◆ deleteRole()
static deleteRole |
( |
|
$role | ) |
|
|
static |
Delete role if not a permanent role. System roles cannot be deleted.
- Parameters
-
◆ deleteRoleAssignment()
static deleteRoleAssignment |
( |
User |
$user, |
|
|
|
$role, |
|
|
|
$institut_id = null |
|
) |
| |
|
static |
Deletes a role assignment from the database
- Parameters
-
◆ deleteRoleAssignmentFromPerm()
static deleteRoleAssignmentFromPerm |
( |
string |
$perm, |
|
|
Role |
$role |
|
) |
| |
|
static |
Removes a role from a stud.ip permission. System roles cannot be removed from permissions.
- Parameters
-
- Returns
- bool
- Exceptions
-
◆ deleteRoleByName()
static deleteRoleByName |
( |
string |
$role_name | ) |
|
|
static |
Delete role by name if not a permanent role. System roles cannot be deleted.
- Parameters
-
- Returns
- bool
◆ expireCaches()
◆ expirePluginCache()
static expirePluginCache |
( |
|
$plugin_id = null | ) |
|
|
static |
Expires all cached plugin role assignments.
- Parameters
-
string | int | null | $plugin_id | Optional plugin id to expire the cache for. If none is given, the whole cache is cleared. |
◆ expireRolesCache()
static expireRolesCache |
( |
| ) |
|
|
static |
Expires all cached roles.
◆ expireUserCache()
static expireUserCache |
( |
|
$user_id = null | ) |
|
|
static |
Expires all cached user role assignments.
- Parameters
-
string | null | $user_id | Optional user id to expire the cache for. If none is given, the whole cache is cleared. |
◆ getAllRoleAssignments()
static getAllRoleAssignments |
( |
|
$user = null | ) |
|
|
static |
Get's all Role-Assignments for a certain user. If no user is set, all role assignments are returned.
- Parameters
-
- Returns
- array with roleids and the assigned userids
◆ getAllRoles()
static getAllRoles |
( |
bool |
$grouped = false | ) |
|
|
static |
Returns all available roles.
- Parameters
-
bool | $grouped | Return the roles grouped by system type or other |
- Returns
- Role[]|array{system: Role[], other: Role[]}
◆ getAssignedPluginRoles()
static getAssignedPluginRoles |
( |
|
$plugin_id | ) |
|
|
static |
Return all roles assigned to a plugin.
- Parameters
-
- Returns
- array
◆ getAssignedRoleInstitutes()
static getAssignedRoleInstitutes |
( |
|
$user_id, |
|
|
|
$role_id |
|
) |
| |
|
static |
Returns institutes for which the given user has the given role.
- Parameters
-
string | $user_id | User id |
int | $role_id | Role id |
- Returns
- array of institute ids
◆ getAssignedRoles()
static getAssignedRoles |
( |
|
$user_id, |
|
|
|
$implicit = false |
|
) |
| |
|
static |
Gets all assigned roles from the database for a user
- Parameters
-
int | $userid | |
boolean | $implicit | |
- Returns
- array
◆ getRoleIdByName()
static getRoleIdByName |
( |
|
$name | ) |
|
|
static |
◆ getStatistics()
Returns statistic values for each role:
- number of explicitely assigned users
- number of implicitely assigned users
- number of assigned plugins
- Returns
- array
◆ getUsersWithRoleById()
static getUsersWithRoleById |
( |
int |
$role_id, |
|
|
bool |
$only_explicit = true |
|
) |
| |
|
static |
Returns all users that have a specific role - given by it's id.
- Parameters
-
int | $role_id | Id of the role |
bool | $only_explicit | Only select explicit assignments from table roles_user if true, otherwise also select by perm defined in table roles_studipperms |
- Returns
- User[]
◆ getUsersWithRoleByName()
static getUsersWithRoleByName |
( |
string |
$role_name, |
|
|
bool |
$only_explicit = true |
|
) |
| |
|
static |
Returns all users that have a specific role - given by it's name.
- Parameters
-
string | $role_name | Name of the role |
bool | $only_explicit | Only select explicit assignments from table roles_user if true, otherwise also select by perm defined in table roles_studipperms |
- Returns
- User[]
◆ isAssignedRole()
static isAssignedRole |
( |
|
$userid, |
|
|
|
$assignedrole, |
|
|
|
$institut_id = '' |
|
) |
| |
|
static |
Checks a role assignment for an user optionally check for institute
- Parameters
-
string | $userid | |
string | $assignedrole | |
string | $institut_id | |
- Returns
- boolean
◆ saveRole()
Inserts the role into the database or does an update, if it's already there
- Parameters
-
- Returns
- int the role id
◆ $all_roles
◆ PLUGIN_ROLES_CACHE_KEY
const PLUGIN_ROLES_CACHE_KEY = 'roles/plugin' |
◆ ROLES_CACHE_KEY
const ROLES_CACHE_KEY = 'roles' |
◆ USER_ROLES_CACHE_KEY
const USER_ROLES_CACHE_KEY = 'roles/user' |
The documentation for this class was generated from the following file: