Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
RolePersistence Class Reference

Static Public Member Functions

static getAllRoles ()
 
static getRoleIdByName ($name)
 
static saveRole ($role)
 
static deleteRole ($role)
 
static assignRole (User $user, $role, $institut_id= '')
 
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 getAllRoleAssignments ($user=null)
 
static assignPluginRoles ($plugin_id, $role_ids)
 
static deleteAssignedPluginRoles ($plugin_id, $role_ids)
 
static getAssignedPluginRoles ($plugin_id)
 
static getStatistics ()
 
static countImplicitUsers ($role_id)
 
static expireRolesCache ()
 
static expireUserCache ($user_id)
 

Data Fields

const ROLES_CACHE_KEY = 'roles'
 
const USER_ROLES_CACHE_KEY = 'roles/user'
 
const PLUGIN_ROLES_CACHE_KEY = 'roles/plugin'
 

Member Function Documentation

static assignPluginRoles (   $plugin_id,
  $role_ids 
)
static

Enter description here...

Parameters
int$pluginid
array$roleids
static assignRole ( User  $user,
  $role,
  $institut_id = '' 
)
static

Saves a role assignment to the database

Parameters
User$user
Role$role
string$institut_id
static countImplicitUsers (   $role_id)
static

Counts the implicitely assigned users for a role.

Parameters
mixed$role_idRole 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
static deleteAssignedPluginRoles (   $plugin_id,
  $role_ids 
)
static

Removes the given roles' assignments from the given plugin.

Parameters
int$pluginid
array$roleids
static deleteRole (   $role)
static

Delete role if not a permanent role. System roles cannot be deleted.

Parameters
Role$role
static deleteRoleAssignment ( User  $user,
  $role,
  $institut_id = null 
)
static

Deletes a role assignment from the database

Parameters
User$user
Role$role
String$institut_id
static expireRolesCache ( )
static
static expireUserCache (   $user_id)
static
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
User$user
Returns
array with roleids and the assigned userids
static getAllRoles ( )
static

Returns all available roles.

Returns
array Roles
static getAssignedPluginRoles (   $plugin_id)
static

Return all roles assigned to a plugin.

Parameters
int$pluginid
Returns
array
static getAssignedRoleInstitutes (   $user_id,
  $role_id 
)
static

Returns institutes for which the given user has the given role.

Parameters
string$user_idUser id
int$role_idRole id
Returns
array of institute ids
static getAssignedRoles (   $user_id,
  $implicit = false 
)
static

Gets all assigned roles from the database for a user

Parameters
int$userid
boolean$implicit
Returns
array
static getRoleIdByName (   $name)
static
static getStatistics ( )
static

Returns statistic values for each role:

  • number of explicitely assigned users
  • number of implicitely assigned users
  • number of assigned plugins
Returns
array
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
static saveRole (   $role)
static

Inserts the role into the database or does an update, if it's already there

Parameters
Role$role
Returns
int the role id

Field Documentation

const PLUGIN_ROLES_CACHE_KEY = 'roles/plugin'
const ROLES_CACHE_KEY = 'roles'
const USER_ROLES_CACHE_KEY = 'roles/user'

The documentation for this class was generated from the following file: