Stud.IP  trunk Revision
RolePersistence Class Reference
Collaboration diagram for RolePersistence:
Collaboration graph

Static Public Member Functions

static getAllRoles ()
 
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)
 

Data Fields

const ROLES_CACHE_KEY = 'plugins/rolepersistence/roles'
 
const ROLES_PLUGINS_CACHE_KEY = 'plugins/rolepersistence/roles_plugins/'
 

Member Function Documentation

◆ assignPluginRoles()

static assignPluginRoles (   $plugin_id,
  $role_ids 
)
static

Enter description here...

Parameters
int$pluginid
array$roleids
Here is the call graph for this function:
Here is the caller graph for this function:

◆ assignRole()

static assignRole ( User  $user,
  $role,
  $institut_id = '' 
)
static

Saves a role assignment to the database

Parameters
User$user
Role$role
string$institut_id
Here is the call graph for this function:
Here is the caller graph for this function:

◆ countImplicitUsers()

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deleteAssignedPluginRoles()

static deleteAssignedPluginRoles (   $plugin_id,
  $role_ids 
)
static

Removes the given roles' assignments from the given plugin.

Parameters
int$pluginid
array$roleids
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deleteRole()

static deleteRole (   $role)
static

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

Parameters
Role$role
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deleteRoleAssignment()

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

Deletes a role assignment from the database

Parameters
User$user
Role$role
String$institut_id
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
User$user
Returns
array with roleids and the assigned userids
Deprecated:
seems to be unused (and was corrupt for some versions)
Here is the call graph for this function:

◆ getAllRoles()

static getAllRoles ( )
static

Returns all available roles.

Returns
array Roles
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAssignedPluginRoles()

static getAssignedPluginRoles (   $plugin_id)
static

Return all roles assigned to a plugin.

Parameters
int$pluginid
Returns
array
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAssignedRoleInstitutes()

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getStatistics()

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveRole()

static saveRole (   $role)
static

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

Parameters
Role$role
Returns
the role id
Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ ROLES_CACHE_KEY

const ROLES_CACHE_KEY = 'plugins/rolepersistence/roles'

◆ ROLES_PLUGINS_CACHE_KEY

const ROLES_PLUGINS_CACHE_KEY = 'plugins/rolepersistence/roles_plugins/'

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