ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilRbacReview Class Reference

class ilRbacReview Contains Review functions of core Rbac. More...

+ Collaboration diagram for ilRbacReview:

Public Member Functions

 __construct ()
 Constructor public. More...
 
 roleExists (string $a_title, int $a_id=0)
 Checks if a role already exists. More...
 
 getParentRoleIds (int $a_endnode_id, bool $a_templates=false)
 Get an array of parent role ids of all parent roles, if last parameter is set true you get also all parent templates. More...
 
 getRoleListByObject (int $a_ref_id, bool $a_templates=false)
 Returns a list of roles in an container. More...
 
 getAssignableRoles (bool $a_templates=false, bool $a_internal_roles=false, string $title_filter='')
 Returns a list of all assignable roles. More...
 
 getAssignableRolesInSubtree (int $ref_id)
 Returns a list of assignable roles in a subtree of the repository. More...
 
 getAssignableChildRoles (int $a_ref_id)
 Get all assignable roles directly under a specific node. More...
 
 getNumberOfAssignedUsers (array $a_roles)
 Get the number of assigned users to roles (not properly deleted user accounts are not counted) More...
 
 assignedUsers (int $a_rol_id)
 get all assigned users to a given role More...
 
 isAssigned (int $a_usr_id, int $a_role_id)
 check if a specific user is assigned to specific role More...
 
 isAssignedToAtLeastOneGivenRole (int $a_usr_id, array $a_role_ids)
 check if a specific user is assigned to at least one of the given role ids. More...
 
 assignedRoles (int $a_usr_id)
 get all assigned roles to a given user More...
 
 assignedGlobalRoles (int $a_usr_id)
 Get assigned global roles for an user. More...
 
 isAssignable (int $a_rol_id, int $a_ref_id)
 Check if its possible to assign users. More...
 
 hasMultipleAssignments (int $a_role_id)
 
 getFoldersAssignedToRole (int $a_rol_id, bool $a_assignable=false)
 Returns an array of objects assigned to a role. More...
 
 getRolesOfObject (int $a_ref_id, bool $a_assignable_only=false)
 Get roles of object. More...
 
 getRolesOfRoleFolder (int $a_ref_id, bool $a_nonassignable=true)
 get all roles of a role folder including linked local roles that are created due to stopped inheritance returns an array with role ids public More...
 
 getGlobalRoles ()
 get only 'global' roles More...
 
 getLocalRoles (int $a_ref_id)
 Get local roles of object. More...
 
 getLocalPolicies (int $a_ref_id)
 Get all roles with local policies. More...
 
 getGlobalRolesArray ()
 get only 'global' roles More...
 
 getGlobalAssignableRoles ()
 get only 'global' roles (with flag 'assign_users') More...
 
 isRoleAssignedToObject (int $a_role_id, int $a_parent_id)
 Check if role is assigned to an object. More...
 
 getOperations ()
 get all possible operations More...
 
 getOperation (int $ops_id)
 get one operation by operation id More...
 
 getAllOperationsOfRole (int $a_rol_id, int $a_parent=0)
 get all possible operations of a specific role The ref_id of the role folder (parent object) is necessary to distinguish local roles More...
 
 getActiveOperationsOfRole (int $a_ref_id, int $a_role_id)
 Get active operations for a role. More...
 
 getOperationsOfRole (int $a_rol_id, string $a_type, int $a_parent=0)
 get all possible operations of a specific role The ref_id of the role folder (parent object) is necessary to distinguish local roles More...
 
 getRoleOperationsOnObject (int $a_role_id, int $a_ref_id)
 
 getOperationsOnType (int $a_typ_id)
 all possible operations of a type More...
 
 getOperationsOnTypeString (string $a_type)
 all possible operations of a type More...
 
 getOperationsByTypeAndClass (string $a_type, string $a_class)
 Get operations by type and class. More...
 
 getObjectsWithStopedInheritance (int $a_rol_id, array $a_filter=[])
 get all objects in which the inheritance of role with role_id was stopped the function returns all reference ids of objects containing a role folder. More...
 
 isDeleted (int $a_node_id)
 Checks if a rolefolder is set as deleted (negative tree_id) More...
 
 isGlobalRole (int $a_role_id)
 Check if role is a global role. More...
 
 getRolesByFilter (int $a_filter=0, int $a_user_id=0, string $title_filter='')
 
 getTypeId (string $a_type)
 
 isProtected (int $a_ref_id, int $a_role_id)
 ref_id not used yet. More...
 
 isBlockedAtPosition (int $a_role_id, int $a_ref_id)
 
 isBlockedInUpperContext (int $a_role_id, int $a_ref_id)
 Check if role is blocked in upper context. More...
 
 getObjectOfRole (int $a_role_id)
 Get object id of objects a role is assigned to. More...
 
 getObjectReferenceOfRole (int $a_role_id)
 
 isRoleDeleted (int $a_role_id)
 return if role is only attached to deleted role folders More...
 
 getRolesForIDs (array $role_ids, bool $use_templates)
 
 getOperationAssignment ()
 get operation assignments More...
 
 isDeleteable (int $a_role_id, int $a_rolf_id)
 Check if role is deleteable at a specific position. More...
 
 isSystemGeneratedRole (int $a_role_id)
 Check if the role is system generate role or role template. More...
 
 getRoleFolderOfRole (int $a_role_id)
 
 getUserPermissionsOnObject (int $a_user_id, int $a_ref_id)
 Get all user permissions on an object. More...
 
 setAssignedCacheEntry (int $a_role_id, int $a_user_id, bool $a_value)
 set entry of assigned_chache More...
 
 getAssignedCacheEntry (int $a_role_id, int $a_user_id)
 
 clearCaches ()
 Clear assigned users caches. More...
 

Static Public Member Functions

static _getOperationIdsByName (array $operations)
 get ops_id's by name. More...
 
static _getOperationIdByName (string $a_operation)
 get operation id by name of operation More...
 
static lookupCreateOperationIds (array $a_type_arr)
 Lookup operation ids. More...
 
static _getOperationList (string $a_type='')
 get operation list by object type More...
 
static _groupOperationsByClass (array $a_ops_arr)
 
static _getCustomRBACOperationId (string $operation, \ilDBInterface $ilDB=null)
 
static _isRBACOperation (int $type_id, int $ops_id, \ilDBInterface $ilDB=null)
 

Data Fields

const FILTER_ALL = 1
 
const FILTER_ALL_GLOBAL = 2
 
const FILTER_ALL_LOCAL = 3
 
const FILTER_INTERNAL = 4
 
const FILTER_NOT_INTERNAL = 5
 
const FILTER_TEMPLATES = 6
 

Protected Member Functions

 __getParentRoles (array $a_path, bool $a_templates)
 Note: This function performs faster than the new getParentRoles function, because it uses database indexes whereas getParentRoles needs a full table space scan. More...
 
 __setTemplateFilter (bool $a_templates)
 get roles and templates or only roles; returns string for where clause More...
 
 __setRoleType (array $a_role_list)
 computes role type in role list array: global: roles in ROLE_FOLDER_ID local: assignable roles in other role folders linked: roles with stoppped inheritance template: role templates More...
 
 __setProtectedStatus (array $a_parent_roles, array $a_role_hierarchy, int $a_ref_id)
 

Protected Attributes

ilLogger $log
 
ilDBInterface $db
 

Static Protected Attributes

static array $assigned_users_cache = []
 
static array $is_assigned_cache = []
 

Private Member Functions

 getAssignableRolesGenerator (bool $a_templates=false, bool $a_internal_roles=false, string $title_filter='')
 
 setRoleTypeAndProtection (array $role_list_entry)
 
 buildRoleType (array $role_list_entry)
 
 buildProtectionByStringValue (string $value)
 

Static Private Attributes

static array $_opsCache = null
 

Detailed Description

class ilRbacReview Contains Review functions of core Rbac.

This class offers the possibility to view the contents of the user <-> role (UR) relation and the permission <-> role (PR) relation. For example, from the UA relation the administrator should have the facility to view all user assigned to a given role.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Sascha Hofmann sasch.nosp@m.ahof.nosp@m.mann@.nosp@m.gmx..nosp@m.de
Version
$Id$

-type RoleListEntry array{obj_id: int, rol_id: int, parent: int, user_id: int, owner: int, title: ?string, desc: string, description: string, create_date: ?string, last_update: ?string, import_id: ?string, tile_image_rid: ?string, role_type: string, offline: ?int, type: string, assign: string, protected: bool, blocked: int, rol_id: int}

Definition at line 33 of file class.ilRbacReview.php.

Constructor & Destructor Documentation

◆ __construct()

ilRbacReview::__construct ( )

Constructor public.

Definition at line 55 of file class.ilRbacReview.php.

References $DIC, and ilLoggerFactory\getLogger().

56  {
57  global $DIC;
58 
59  $this->log = ilLoggerFactory::getLogger('ac');
60  $this->db = $DIC->database();
61  }
static getLogger(string $a_component_id)
Get component logger.
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ __getParentRoles()

ilRbacReview::__getParentRoles ( array  $a_path,
bool  $a_templates 
)
protected

Note: This function performs faster than the new getParentRoles function, because it uses database indexes whereas getParentRoles needs a full table space scan.

Get parent roles in a path. If last parameter is set 'true' it delivers also all templates in the path

Parameters
arrayarray with path_ids
booltrue for role templates (default: false)
Returns
array array with all parent roles (obj_ids)

Definition at line 95 of file class.ilRbacReview.php.

References $id, $ref_id, __setProtectedStatus(), getRoleListByObject(), and ILIAS\Repository\int().

Referenced by getParentRoleIds().

95  : array
96  {
97  $parent_roles = [];
98  $role_hierarchy = [];
99  foreach ($a_path as $ref_id) {
100  $roles = $this->getRoleListByObject($ref_id, $a_templates);
101  foreach ($roles as $role) {
102  $id = (int) $role["obj_id"];
103  $role["parent"] = (int) $ref_id;
104  $parent_roles[$id] = $role;
105 
106  if (!array_key_exists($role['obj_id'], $role_hierarchy)) {
107  $role_hierarchy[$id] = $ref_id;
108  }
109  }
110  }
111  return $this->__setProtectedStatus($parent_roles, $role_hierarchy, (int) reset($a_path));
112  }
getRoleListByObject(int $a_ref_id, bool $a_templates=false)
Returns a list of roles in an container.
$ref_id
Definition: ltiauth.php:67
__setProtectedStatus(array $a_parent_roles, array $a_role_hierarchy, int $a_ref_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __setProtectedStatus()

ilRbacReview::__setProtectedStatus ( array  $a_parent_roles,
array  $a_role_hierarchy,
int  $a_ref_id 
)
protected

Definition at line 1085 of file class.ilRbacReview.php.

References $DIC, assignedRoles(), and SYSTEM_ROLE_ID.

Referenced by __getParentRoles().

1085  : array
1086  {
1087  global $DIC;
1088 
1089  $rbacsystem = $DIC->rbac()->system();
1090  $ilUser = $DIC->user();
1091  if (in_array(SYSTEM_ROLE_ID, $this->assignedRoles($ilUser->getId()))) {
1092  $leveladmin = true;
1093  } else {
1094  $leveladmin = false;
1095  }
1096  foreach ($a_role_hierarchy as $role_id => $rolf_id) {
1097  if ($leveladmin == true) {
1098  $a_parent_roles[$role_id]['protected'] = false;
1099  continue;
1100  }
1101 
1102  if ($a_parent_roles[$role_id]['protected'] == true) {
1103  $arr_lvl_roles_user = array_intersect(
1104  $this->assignedRoles($ilUser->getId()),
1105  array_keys($a_role_hierarchy, $rolf_id)
1106  );
1107 
1108  foreach ($arr_lvl_roles_user as $lvl_role_id) {
1109  // check if role grants 'edit_permission' to parent
1110  $rolf = $a_parent_roles[$role_id]['parent'];
1111  if ($rbacsystem->checkPermission($rolf, $lvl_role_id, 'edit_permission')) {
1112  $a_parent_roles[$role_id]['protected'] = false;
1113  }
1114  }
1115  }
1116  }
1117  return $a_parent_roles;
1118  }
const SYSTEM_ROLE_ID
Definition: constants.php:29
global $DIC
Definition: feed.php:28
assignedRoles(int $a_usr_id)
get all assigned roles to a given user
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __setRoleType()

ilRbacReview::__setRoleType ( array  $a_role_list)
protected

computes role type in role list array: global: roles in ROLE_FOLDER_ID local: assignable roles in other role folders linked: roles with stoppped inheritance template: role templates

Definition at line 285 of file class.ilRbacReview.php.

References ILIAS\LTI\ToolProvider\$key, and setRoleTypeAndProtection().

Referenced by getRoleListByObject(), and getRolesForIDs().

285  : array
286  {
287  foreach ($a_role_list as $key => $val) {
288  $a_role_list[$key] = $this->setRoleTypeAndProtection($val);
289  }
290  return $a_role_list;
291  }
setRoleTypeAndProtection(array $role_list_entry)
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __setTemplateFilter()

ilRbacReview::__setTemplateFilter ( bool  $a_templates)
protected

get roles and templates or only roles; returns string for where clause

Definition at line 268 of file class.ilRbacReview.php.

Referenced by getAssignableRolesGenerator(), getRoleListByObject(), and getRolesForIDs().

268  : string
269  {
270  if ($a_templates) {
271  $where = "WHERE " . $this->db->in('object_data.type', ['role', 'rolt'], false, 'text') . " ";
272  } else {
273  $where = "WHERE " . $this->db->in('object_data.type', ['role'], false, 'text') . " ";
274  }
275  return $where;
276  }
+ Here is the caller graph for this function:

◆ _getCustomRBACOperationId()

static ilRbacReview::_getCustomRBACOperationId ( string  $operation,
\ilDBInterface  $ilDB = null 
)
static

Definition at line 1392 of file class.ilRbacReview.php.

References $DIC, $ilDB, and $res.

Referenced by ILIAS\Wiki\Setup\AccessRBACOperationClonedObjective\achieve(), ilAccessRolePermissionSetObjective\achieve(), ilAccessCustomRBACOperationAddedObjective\achieve(), ilAccessRbacStandardOperationsAddedObjective\achieve(), ilAccessInitialPermissionGuidelineAppliedObjective\achieve(), ilDBUpdateNewObjectType\addCustomRBACOperation(), ilDBUpdateNewObjectType\addRBACOperations(), ilDBUpdateNewObjectType\applyInitialPermissionGuideline(), ilAccessRbacStandardOperationsAddedObjective\isApplicable(), ilAccessCustomRBACOperationAddedObjective\isApplicable(), ilAccessInitialPermissionGuidelineAppliedObjective\isApplicable(), and ilDBUpdateNewObjectType\setRolePermission().

1392  : ?int
1393  {
1394  if (!$ilDB) {
1395  global $DIC;
1396  $ilDB = $DIC->database();
1397  }
1398 
1399  $sql =
1400  "SELECT ops_id" . PHP_EOL
1401  . "FROM rbac_operations" . PHP_EOL
1402  . "WHERE operation = " . $ilDB->quote($operation, "text") . PHP_EOL
1403  ;
1404 
1405  $res = $ilDB->query($sql);
1406  if ($ilDB->numRows($res) == 0) {
1407  return null;
1408  }
1409 
1410  $row = $ilDB->fetchAssoc($res);
1411  return (int) $row["ops_id"] ?? null;
1412  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ _getOperationIdByName()

static ilRbacReview::_getOperationIdByName ( string  $a_operation)
static

get operation id by name of operation

Definition at line 965 of file class.ilRbacReview.php.

References $DIC, $ilDB, $q, $r, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by ilRepositoryObjectPlugin\beforeActivation(), ilRbacSystem\checkAccessOfUser(), and ilObjBlog\getRolesWithContributeOrRedact().

965  : int
966  {
967  global $DIC;
968 
969  $ilDB = $DIC->database();
970 
971  // Cache operation ids
972  if (!is_array(self::$_opsCache)) {
973  self::$_opsCache = [];
974 
975  $q = "SELECT ops_id, operation FROM rbac_operations";
976  $r = $ilDB->query($q);
977  while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
978  self::$_opsCache[$row->operation] = (int) $row->ops_id;
979  }
980  }
981 
982  // Get operation ID by name from cache
983  if (array_key_exists($a_operation, self::$_opsCache)) {
984  return self::$_opsCache[$a_operation];
985  }
986  return 0;
987  }
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getOperationIdsByName()

static ilRbacReview::_getOperationIdsByName ( array  $operations)
static

get ops_id's by name.

Example usage: $rbacadmin->grantPermission($roles,ilRbacReview::_getOperationIdsByName(array('visible','read'),$ref_id));

Definition at line 942 of file class.ilRbacReview.php.

References $DIC, $ilDB, $res, and ILIAS\Repository\int().

Referenced by ilUtil\_getObjectsByOperations(), ilLTIProviderObjectSettingGUI\checkLocalRole(), and ilECSObjectSettings\handlePermissionUpdate().

942  : array
943  {
944  global $DIC;
945 
946  $ilDB = $DIC->database();
947  if ($operations === []) {
948  return [];
949  }
950 
951  $query = 'SELECT ops_id FROM rbac_operations ' .
952  'WHERE ' . $ilDB->in('operation', $operations, false, 'text');
953 
954  $res = $ilDB->query($query);
955  $ops_ids = [];
956  while ($row = $ilDB->fetchObject($res)) {
957  $ops_ids[] = (int) $row->ops_id;
958  }
959  return $ops_ids;
960  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getOperationList()

static ilRbacReview::_getOperationList ( string  $a_type = '')
static

get operation list by object type

Definition at line 1123 of file class.ilRbacReview.php.

References $DIC, $ilDB, $res, and ILIAS\Repository\int().

Referenced by ilSettingsPermissionGUI\__construct(), ilObjTypeDefinitionGUI\editObject(), ilObjectPermissionStatusGUI\getAccessPermissionTableData(), ilObjectPermissionStatusGUI\getAssignedValidRoles(), and ilObjTypeDefinitionGUI\viewObject().

1123  : array
1124  {
1125  global $DIC;
1126 
1127  $ilDB = $DIC->database();
1128  $arr = [];
1129  if ($a_type) {
1130  $query = sprintf(
1131  'SELECT * FROM rbac_operations ' .
1132  'JOIN rbac_ta ON rbac_operations.ops_id = rbac_ta.ops_id ' .
1133  'JOIN object_data ON rbac_ta.typ_id = object_data.obj_id ' .
1134  'WHERE object_data.title = %s ' .
1135  'AND object_data.type = %s ' .
1136  'ORDER BY op_order ASC',
1137  $ilDB->quote($a_type, 'text'),
1138  $ilDB->quote('typ', 'text')
1139  );
1140  } else {
1141  $query = 'SELECT * FROM rbac_operations ORDER BY op_order ASC';
1142  }
1143  $res = $ilDB->query($query);
1144  while ($row = $ilDB->fetchAssoc($res)) {
1145  $arr[] = [
1146  "ops_id" => (int) $row['ops_id'],
1147  "operation" => $row['operation'],
1148  "desc" => $row['description'],
1149  "class" => $row['class'],
1150  "order" => (int) $row['op_order']
1151  ];
1152  }
1153  return $arr;
1154  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _groupOperationsByClass()

static ilRbacReview::_groupOperationsByClass ( array  $a_ops_arr)
static

Definition at line 1156 of file class.ilRbacReview.php.

References ILIAS\Repository\int().

1156  : array
1157  {
1158  $arr = [];
1159  foreach ($a_ops_arr as $ops) {
1160  $arr[$ops['class']][] = ['ops_id' => (int) $ops['ops_id'],
1161  'name' => $ops['operation']
1162  ];
1163  }
1164  return $arr;
1165  }
+ Here is the call graph for this function:

◆ _isRBACOperation()

static ilRbacReview::_isRBACOperation ( int  $type_id,
int  $ops_id,
\ilDBInterface  $ilDB = null 
)
static

Definition at line 1414 of file class.ilRbacReview.php.

References $DIC, and $ilDB.

Referenced by ilTreeAdminNodeAddedObjective\achieve(), ilAccessRbacStandardOperationsAddedObjective\achieve(), and ilAccessRbacStandardOperationsAddedObjective\isApplicable().

1414  : bool
1415  {
1416  if (!$ilDB) {
1417  global $DIC;
1418  $ilDB = $DIC->database();
1419  }
1420 
1421  $sql =
1422  "SELECT typ_id" . PHP_EOL
1423  . "FROM rbac_ta" . PHP_EOL
1424  . "WHERE typ_id = " . $ilDB->quote($type_id, "integer") . PHP_EOL
1425  . "AND ops_id = " . $ilDB->quote($ops_id, "integer") . PHP_EOL
1426  ;
1427 
1428  return (bool) $ilDB->numRows($ilDB->query($sql));
1429  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ assignedGlobalRoles()

ilRbacReview::assignedGlobalRoles ( int  $a_usr_id)

Get assigned global roles for an user.

Definition at line 427 of file class.ilRbacReview.php.

References $res, ROLE_FOLDER_ID, and ilDBConstants\T_INTEGER.

427  : array
428  {
429  $query = "SELECT ua.rol_id FROM rbac_ua ua " .
430  "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
431  "WHERE usr_id = " . $this->db->quote($a_usr_id, 'integer') . ' ' .
432  "AND parent = " . $this->db->quote(ROLE_FOLDER_ID, ilDBConstants::T_INTEGER) . " " .
433  "AND assign = 'y' ";
434 
435  $res = $this->db->query($query);
436  $role_arr = [];
437  while ($row = $this->db->fetchObject($res)) {
438  $role_arr[] = $row->rol_id;
439  }
440  return $role_arr !== [] ? $role_arr : [];
441  }
$res
Definition: ltiservices.php:69
const ROLE_FOLDER_ID
Definition: constants.php:34

◆ assignedRoles()

ilRbacReview::assignedRoles ( int  $a_usr_id)

get all assigned roles to a given user

Parameters
intusr_id
Returns
int[] all roles (id) the user is assigned to

Definition at line 412 of file class.ilRbacReview.php.

References $res, and ILIAS\Repository\int().

Referenced by __setProtectedStatus(), ILIAS\Portfolio\Administration\PortfolioRoleAssignmentManager\assignPortfoliosOnLogin(), ilObjCategoryGUI\assignRolesObject(), ilObjCategoryGUI\assignSaveObject(), ilObjCategoryGUI\checkGlobalRoles(), ilObjCategoryGUI\getAssignableRoles(), getRolesByFilter(), ilCalendarShared\getSharedCalendarsForUser(), ilCalendarShared\isSharedWithUser(), and ilObjCategoryGUI\listUsersObject().

412  : array
413  {
414  $query = "SELECT rol_id FROM rbac_ua WHERE usr_id = " . $this->db->quote($a_usr_id, 'integer');
415 
416  $res = $this->db->query($query);
417  $role_arr = [];
418  while ($row = $this->db->fetchObject($res)) {
419  $role_arr[] = (int) $row->rol_id;
420  }
421  return $role_arr;
422  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignedUsers()

ilRbacReview::assignedUsers ( int  $a_rol_id)

get all assigned users to a given role

Parameters
int$a_rol_id
Returns
int[] all users (id) assigned to role

Definition at line 349 of file class.ilRbacReview.php.

References $res, and ILIAS\Repository\int().

Referenced by ilContributorTableGUI\getItems().

349  : array
350  {
351  if (isset(self::$assigned_users_cache[$a_rol_id])) {
352  return self::$assigned_users_cache[$a_rol_id];
353  }
354 
355  $result_arr = [];
356  $query = "SELECT usr_id FROM rbac_ua WHERE rol_id= " . $this->db->quote($a_rol_id, 'integer');
357  $res = $this->db->query($query);
358  while ($row = $this->db->fetchAssoc($res)) {
359  $result_arr[] = (int) $row["usr_id"];
360  }
361  self::$assigned_users_cache[$a_rol_id] = $result_arr;
362  return $result_arr;
363  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildProtectionByStringValue()

ilRbacReview::buildProtectionByStringValue ( string  $value)
private

Definition at line 317 of file class.ilRbacReview.php.

Referenced by setRoleTypeAndProtection().

317  : bool
318  {
319  if ($value === 'y') {
320  return true;
321  }
322  return false;
323  }
+ Here is the caller graph for this function:

◆ buildRoleType()

ilRbacReview::buildRoleType ( array  $role_list_entry)
private

Definition at line 300 of file class.ilRbacReview.php.

References ROLE_FOLDER_ID.

Referenced by setRoleTypeAndProtection().

300  : string
301  {
302  if ($role_list_entry['type'] === 'rolt') {
303  return 'template';
304  }
305 
306  if ($role_list_entry['assign'] !== 'y') {
307  return 'linked';
308  }
309 
310  if ($role_list_entry['parent'] === ROLE_FOLDER_ID) {
311  return 'global';
312  }
313 
314  return 'local';
315  }
const ROLE_FOLDER_ID
Definition: constants.php:34
+ Here is the caller graph for this function:

◆ clearCaches()

ilRbacReview::clearCaches ( )

Clear assigned users caches.

Definition at line 1386 of file class.ilRbacReview.php.

1386  : void
1387  {
1388  self::$is_assigned_cache = [];
1389  self::$assigned_users_cache = [];
1390  }

◆ getActiveOperationsOfRole()

ilRbacReview::getActiveOperationsOfRole ( int  $a_ref_id,
int  $a_role_id 
)

Get active operations for a role.

Definition at line 687 of file class.ilRbacReview.php.

References $res, and ilDBConstants\FETCHMODE_ASSOC.

687  : array
688  {
689  $query = 'SELECT * FROM rbac_pa ' .
690  'WHERE ref_id = ' . $this->db->quote($a_ref_id, 'integer') . ' ' .
691  'AND rol_id = ' . $this->db->quote($a_role_id, 'integer') . ' ';
692 
693  $res = $this->db->query($query);
694  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
695  return $row['ops_id'] === ':' ? [] : unserialize($row['ops_id']);
696  }
697  return [];
698  }
$res
Definition: ltiservices.php:69

◆ getAllOperationsOfRole()

ilRbacReview::getAllOperationsOfRole ( int  $a_rol_id,
int  $a_parent = 0 
)

get all possible operations of a specific role The ref_id of the role folder (parent object) is necessary to distinguish local roles

Definition at line 667 of file class.ilRbacReview.php.

References $res, ILIAS\Repository\int(), and ROLE_FOLDER_ID.

667  : array
668  {
669  if (!$a_parent) {
670  $a_parent = ROLE_FOLDER_ID;
671  }
672  $query = "SELECT ops_id,type FROM rbac_templates " .
673  "WHERE rol_id = " . $this->db->quote($a_rol_id, 'integer') . " " .
674  "AND parent = " . $this->db->quote($a_parent, 'integer');
675  $res = $this->db->query($query);
676 
677  $ops_arr = [];
678  while ($row = $this->db->fetchObject($res)) {
679  $ops_arr[$row->type][] = (int) $row->ops_id;
680  }
681  return $ops_arr;
682  }
$res
Definition: ltiservices.php:69
const ROLE_FOLDER_ID
Definition: constants.php:34
+ Here is the call graph for this function:

◆ getAssignableChildRoles()

ilRbacReview::getAssignableChildRoles ( int  $a_ref_id)

Get all assignable roles directly under a specific node.

Definition at line 245 of file class.ilRbacReview.php.

References $res, and ILIAS\Repository\int().

Referenced by ilObjCategoryGUI\getAssignableRoles().

245  : array
246  {
247  $query = "SELECT fa.*, rd.* " .
248  "FROM object_data rd " .
249  "JOIN rbac_fa fa ON rd.obj_id = fa.rol_id " .
250  "WHERE fa.assign = 'y' " .
251  "AND fa.parent = " . $this->db->quote($a_ref_id, 'integer') . " ";
252 
253  $res = $this->db->query($query);
254  $roles_data = [];
255  while ($row = $this->db->fetchAssoc($res)) {
256  $row['rol_id'] = (int) $row['rol_id'];
257  $row['obj_id'] = (int) $row['obj_id'];
258 
259  $roles_data[] = $row;
260  }
261 
262  return $roles_data;
263  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssignableRoles()

ilRbacReview::getAssignableRoles ( bool  $a_templates = false,
bool  $a_internal_roles = false,
string  $title_filter = '' 
)

Returns a list of all assignable roles.

Returns
list<RoleListEntry>

Definition at line 168 of file class.ilRbacReview.php.

References getAssignableRolesGenerator().

172  : array {
173  return iterator_to_array(
175  $a_templates,
176  $a_internal_roles,
177  $title_filter
178  )
179  );
180  }
getAssignableRolesGenerator(bool $a_templates=false, bool $a_internal_roles=false, string $title_filter='')
+ Here is the call graph for this function:

◆ getAssignableRolesGenerator()

ilRbacReview::getAssignableRolesGenerator ( bool  $a_templates = false,
bool  $a_internal_roles = false,
string  $title_filter = '' 
)
private
Returns
Generator<RoleListEntry>

Definition at line 185 of file class.ilRbacReview.php.

References $res, __setTemplateFilter(), ILIAS\Repository\int(), and setRoleTypeAndProtection().

Referenced by getAssignableRoles(), and getRolesByFilter().

189  : Generator {
190  $where = $this->__setTemplateFilter($a_templates);
191  $query = "SELECT * FROM object_data " .
192  "JOIN rbac_fa ON obj_id = rol_id " .
193  $where .
194  "AND rbac_fa.assign = 'y' ";
195 
196  if (strlen($title_filter)) {
197  $query .= (' AND ' . $this->db->like(
198  'title',
199  'text',
200  $title_filter . '%'
201  ));
202  }
203  $res = $this->db->query($query);
204 
205  while ($row = $this->db->fetchAssoc($res)) {
206  $row["description"] = (string) $row["description"];
207  $row["desc"] = $row["description"];
208  $row["user_id"] = (int) $row["owner"];
209  $row['obj_id'] = (int) $row['obj_id'];
210  $row['parent'] = (int) $row['parent'];
211  yield $this->setRoleTypeAndProtection($row);
212  }
213  }
$res
Definition: ltiservices.php:69
setRoleTypeAndProtection(array $role_list_entry)
__setTemplateFilter(bool $a_templates)
get roles and templates or only roles; returns string for where clause
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssignableRolesInSubtree()

ilRbacReview::getAssignableRolesInSubtree ( int  $ref_id)

Returns a list of assignable roles in a subtree of the repository.

Todo:
move tree to construct.

Currently this is not possible due to init sequence

Definition at line 219 of file class.ilRbacReview.php.

References $DIC, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

219  : array
220  {
221  global $DIC;
222 
223  $tree = $DIC->repositoryTree();
224  $query = 'SELECT rol_id FROM rbac_fa fa ' .
225  'JOIN tree t1 ON t1.child = fa.parent ' .
226  'JOIN object_data obd ON fa.rol_id = obd.obj_id ' .
227  'WHERE assign = ' . $this->db->quote('y', 'text') . ' ' .
228  'AND obd.type = ' . $this->db->quote('role', 'text') . ' ' .
229  'AND t1.child IN (' .
230  $tree->getSubTreeQuery($ref_id, ['child']) . ' ' .
231  ') ';
232 
233  $res = $this->db->query($query);
234 
235  $role_list = [];
236  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
237  $role_list[] = (int) $row->rol_id;
238  }
239  return $role_list;
240  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:

◆ getAssignedCacheEntry()

ilRbacReview::getAssignedCacheEntry ( int  $a_role_id,
int  $a_user_id 
)

Definition at line 1378 of file class.ilRbacReview.php.

1378  : bool
1379  {
1380  return self::$is_assigned_cache[$a_role_id][$a_user_id];
1381  }

◆ getFoldersAssignedToRole()

ilRbacReview::getFoldersAssignedToRole ( int  $a_rol_id,
bool  $a_assignable = false 
)

Returns an array of objects assigned to a role.

A role with stopped inheritance may be assigned to more than one objects. To get only the original location of a role, set the second parameter to true public

Parameters
introle id
boolget only rolefolders where role is assignable (true)
Returns
int[] reference IDs of role folders

Definition at line 480 of file class.ilRbacReview.php.

References $res, and ILIAS\Repository\int().

Referenced by isRoleDeleted().

480  : array
481  {
482  $where = '';
483  if ($a_assignable) {
484  $where = " AND assign ='y'";
485  }
486 
487  $query = "SELECT DISTINCT parent FROM rbac_fa " .
488  "WHERE rol_id = " . $this->db->quote($a_rol_id, 'integer') . " " . $where . " ";
489 
490  $res = $this->db->query($query);
491  $folders = [];
492  while ($row = $this->db->fetchObject($res)) {
493  $folders[] = (int) $row->parent;
494  }
495  return $folders;
496  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGlobalAssignableRoles()

ilRbacReview::getGlobalAssignableRoles ( )

get only 'global' roles (with flag 'assign_users')

Definition at line 604 of file class.ilRbacReview.php.

References ilObjRole\_getAssignUsersStatus(), and getGlobalRoles().

Referenced by ilObjCategoryGUI\checkGlobalRoles(), ilObjCategoryGUI\getAssignableRoles(), and ilObjCategoryGUI\listUsersObject().

604  : array
605  {
606  $ga = [];
607  foreach ($this->getGlobalRoles() as $role_id) {
608  if (ilObjRole::_getAssignUsersStatus($role_id)) {
609  $ga[] = ['obj_id' => $role_id,
610  'role_type' => 'global'
611  ];
612  }
613  }
614  return $ga;
615  }
getGlobalRoles()
get only &#39;global&#39; roles
static _getAssignUsersStatus(int $a_role_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGlobalRoles()

ilRbacReview::getGlobalRoles ( )

get only 'global' roles

Returns
int[] Array with rol_ids
Todo:
refactor rolf => DONE

Definition at line 555 of file class.ilRbacReview.php.

References getRolesOfRoleFolder(), and ROLE_FOLDER_ID.

Referenced by ilObjCategoryGUI\checkGlobalRoles(), ILIAS\Portfolio\Administration\PortfolioRoleAssignmentManager\getAvailableRoles(), getGlobalAssignableRoles(), getRolesByFilter(), and isGlobalRole().

555  : array
556  {
557  return $this->getRolesOfRoleFolder(ROLE_FOLDER_ID, false);
558  }
const ROLE_FOLDER_ID
Definition: constants.php:34
getRolesOfRoleFolder(int $a_ref_id, bool $a_nonassignable=true)
get all roles of a role folder including linked local roles that are created due to stopped inheritan...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGlobalRolesArray()

ilRbacReview::getGlobalRolesArray ( )

get only 'global' roles

Definition at line 590 of file class.ilRbacReview.php.

References getRolesOfRoleFolder(), and ROLE_FOLDER_ID.

Referenced by ilObjCategoryGUI\checkGlobalRoles(), and ilObjCategoryGUI\getAssignableRoles().

590  : array
591  {
592  $ga = [];
593  foreach ($this->getRolesOfRoleFolder(ROLE_FOLDER_ID, false) as $role_id) {
594  $ga[] = ['obj_id' => $role_id,
595  'role_type' => 'global'
596  ];
597  }
598  return $ga;
599  }
const ROLE_FOLDER_ID
Definition: constants.php:34
getRolesOfRoleFolder(int $a_ref_id, bool $a_nonassignable=true)
get all roles of a role folder including linked local roles that are created due to stopped inheritan...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLocalPolicies()

ilRbacReview::getLocalPolicies ( int  $a_ref_id)

Get all roles with local policies.

Returns
int[]

Definition at line 578 of file class.ilRbacReview.php.

References getRolesOfRoleFolder().

578  : array
579  {
580  $lroles = [];
581  foreach ($this->getRolesOfRoleFolder($a_ref_id) as $role_id) {
582  $lroles[] = $role_id;
583  }
584  return $lroles;
585  }
getRolesOfRoleFolder(int $a_ref_id, bool $a_nonassignable=true)
get all roles of a role folder including linked local roles that are created due to stopped inheritan...
+ Here is the call graph for this function:

◆ getLocalRoles()

ilRbacReview::getLocalRoles ( int  $a_ref_id)

Get local roles of object.

Definition at line 563 of file class.ilRbacReview.php.

References getRolesOfRoleFolder(), and isAssignable().

563  : array
564  {
565  $lroles = [];
566  foreach ($this->getRolesOfRoleFolder($a_ref_id) as $role_id) {
567  if ($this->isAssignable($role_id, $a_ref_id)) {
568  $lroles[] = $role_id;
569  }
570  }
571  return $lroles;
572  }
getRolesOfRoleFolder(int $a_ref_id, bool $a_nonassignable=true)
get all roles of a role folder including linked local roles that are created due to stopped inheritan...
isAssignable(int $a_rol_id, int $a_ref_id)
Check if its possible to assign users.
+ Here is the call graph for this function:

◆ getNumberOfAssignedUsers()

ilRbacReview::getNumberOfAssignedUsers ( array  $a_roles)

Get the number of assigned users to roles (not properly deleted user accounts are not counted)

Parameters
int[]$a_roles

Definition at line 329 of file class.ilRbacReview.php.

References $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

329  : int
330  {
331  $query = 'select count(distinct(ua.usr_id)) as num from rbac_ua ua ' .
332  'join object_data on ua.usr_id = obj_id ' .
333  'join usr_data ud on ua.usr_id = ud.usr_id ' .
334  'where ' . $this->db->in('rol_id', $a_roles, false, 'integer');
335 
336  $res = $this->db->query($query);
337  if ($res->numRows() > 0) {
338  $row = $res->fetchRow(\ilDBConstants::FETCHMODE_OBJECT);
339  return isset($row->num) && is_numeric($row->num) ? (int) $row->num : 0;
340  }
341  return 0;
342  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:

◆ getObjectOfRole()

ilRbacReview::getObjectOfRole ( int  $a_role_id)

Get object id of objects a role is assigned to.

Todo:
refactor rolf (due to performance reasons the new version does not check for deleted roles only in object reference)

Definition at line 1171 of file class.ilRbacReview.php.

References $res, and ILIAS\Repository\int().

Referenced by ilLDAPRoleGroupMappingSettings\_deleteByServerId().

1171  : int
1172  {
1173  // internal cache
1174  static $obj_cache = [];
1175 
1176  if (isset($obj_cache[$a_role_id]) && $obj_cache[$a_role_id]) {
1177  return $obj_cache[$a_role_id];
1178  }
1179 
1180  $query = 'SELECT obr.obj_id FROM rbac_fa rfa ' .
1181  'JOIN object_reference obr ON rfa.parent = obr.ref_id ' .
1182  'WHERE assign = ' . $this->db->quote('y', 'text') . ' ' .
1183  'AND rol_id = ' . $this->db->quote($a_role_id, 'integer') . ' ' .
1184  'AND deleted IS NULL';
1185 
1186  $res = $this->db->query($query);
1187  $obj_cache[$a_role_id] = 0;
1188  while ($row = $this->db->fetchObject($res)) {
1189  $obj_cache[$a_role_id] = (int) $row->obj_id;
1190  }
1191  return $obj_cache[$a_role_id];
1192  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjectReferenceOfRole()

ilRbacReview::getObjectReferenceOfRole ( int  $a_role_id)

Definition at line 1194 of file class.ilRbacReview.php.

References $res, and ilDBConstants\FETCHMODE_OBJECT.

1194  : int
1195  {
1196  $query = 'SELECT parent p_ref FROM rbac_fa ' .
1197  'WHERE rol_id = ' . $this->db->quote($a_role_id, 'integer') . ' ' .
1198  'AND assign = ' . $this->db->quote('y', 'text');
1199 
1200  $res = $this->db->query($query);
1201  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1202  return (int) $row->p_ref;
1203  }
1204  return 0;
1205  }
$res
Definition: ltiservices.php:69

◆ getObjectsWithStopedInheritance()

ilRbacReview::getObjectsWithStopedInheritance ( int  $a_rol_id,
array  $a_filter = [] 
)

get all objects in which the inheritance of role with role_id was stopped the function returns all reference ids of objects containing a role folder.

Definition at line 800 of file class.ilRbacReview.php.

References $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

800  : array
801  {
802  $query = 'SELECT parent p FROM rbac_fa ' .
803  'WHERE assign = ' . $this->db->quote('n', 'text') . ' ' .
804  'AND rol_id = ' . $this->db->quote($a_rol_id, 'integer') . ' ';
805 
806  if ($a_filter !== []) {
807  $query .= ('AND ' . $this->db->in('parent', (array) $a_filter, false, 'integer'));
808  }
809 
810  $res = $this->db->query($query);
811  $parent = [];
812  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
813  $parent[] = (int) $row->p;
814  }
815  return $parent;
816  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:

◆ getOperation()

ilRbacReview::getOperation ( int  $ops_id)

get one operation by operation id

Definition at line 649 of file class.ilRbacReview.php.

References $res, and ILIAS\Repository\int().

649  : array
650  {
651  $query = 'SELECT * FROM rbac_operations WHERE ops_id = ' . $this->db->quote($ops_id, 'integer');
652  $res = $this->db->query($query);
653  $ops = [];
654  while ($row = $this->db->fetchObject($res)) {
655  $ops = ['ops_id' => (int) $row->ops_id,
656  'operation' => $row->operation,
657  'description' => $row->description
658  ];
659  }
660  return $ops;
661  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:

◆ getOperationAssignment()

ilRbacReview::getOperationAssignment ( )

get operation assignments

Returns
array array(array('typ_id' => $typ_id,'title' => $title,'ops_id => '$ops_is,'operation' => $operation),...

Definition at line 1249 of file class.ilRbacReview.php.

References $DIC, $res, and ILIAS\Repository\int().

1249  : array
1250  {
1251  global $DIC;
1252 
1253  $this->db = $DIC['ilDB'];
1254 
1255  $query = 'SELECT ta.typ_id, obj.title, ops.ops_id, ops.operation FROM rbac_ta ta ' .
1256  'JOIN object_data obj ON obj.obj_id = ta.typ_id ' .
1257  'JOIN rbac_operations ops ON ops.ops_id = ta.ops_id ';
1258  $res = $this->db->query($query);
1259 
1260  $counter = 0;
1261  $info = [];
1262  while ($row = $this->db->fetchObject($res)) {
1263  $info[$counter]['typ_id'] = (int) $row->typ_id;
1264  $info[$counter]['type'] = $row->title;
1265  $info[$counter]['ops_id'] = (int) $row->ops_id;
1266  $info[$counter]['operation'] = $row->operation;
1267  $counter++;
1268  }
1269  return $info;
1270  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ getOperations()

ilRbacReview::getOperations ( )

get all possible operations

Definition at line 632 of file class.ilRbacReview.php.

References $res, and ILIAS\Repository\int().

632  : array
633  {
634  $query = 'SELECT * FROM rbac_operations ORDER BY ops_id ';
635  $res = $this->db->query($query);
636  $ops = [];
637  while ($row = $this->db->fetchObject($res)) {
638  $ops[] = ['ops_id' => (int) $row->ops_id,
639  'operation' => $row->operation,
640  'description' => $row->description
641  ];
642  }
643  return $ops;
644  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:

◆ getOperationsByTypeAndClass()

ilRbacReview::getOperationsByTypeAndClass ( string  $a_type,
string  $a_class 
)

Get operations by type and class.

Definition at line 772 of file class.ilRbacReview.php.

References $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by ilPermissionGUI\savePermissions().

772  : array
773  {
774  if ($a_class != 'create') {
775  $condition = "AND class != " . $this->db->quote('create', 'text');
776  } else {
777  $condition = "AND class = " . $this->db->quote('create', 'text');
778  }
779 
780  $query = "SELECT ro.ops_id FROM rbac_operations ro " .
781  "JOIN rbac_ta rt ON ro.ops_id = rt.ops_id " .
782  "JOIN object_data od ON rt.typ_id = od.obj_id " .
783  "WHERE type = " . $this->db->quote('typ', 'text') . " " .
784  "AND title = " . $this->db->quote($a_type, 'text') . " " .
785  $condition . " " .
786  "ORDER BY op_order ";
787 
788  $res = $this->db->query($query);
789  $ops = [];
790  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
791  $ops[] = (int) $row->ops_id;
792  }
793  return $ops;
794  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOperationsOfRole()

ilRbacReview::getOperationsOfRole ( int  $a_rol_id,
string  $a_type,
int  $a_parent = 0 
)

get all possible operations of a specific role The ref_id of the role folder (parent object) is necessary to distinguish local roles

Definition at line 704 of file class.ilRbacReview.php.

References $res, and ROLE_FOLDER_ID.

704  : array
705  {
706  $ops_arr = [];
707  // if no rolefolder id is given, assume global role folder as target
708  if ($a_parent == 0) {
709  $a_parent = ROLE_FOLDER_ID;
710  }
711 
712  $query = "SELECT ops_id FROM rbac_templates " .
713  "WHERE type =" . $this->db->quote($a_type, 'text') . " " .
714  "AND rol_id = " . $this->db->quote($a_rol_id, 'integer') . " " .
715  "AND parent = " . $this->db->quote($a_parent, 'integer');
716  $res = $this->db->query($query);
717  while ($row = $this->db->fetchObject($res)) {
718  $ops_arr[] = $row->ops_id;
719  }
720  return $ops_arr;
721  }
$res
Definition: ltiservices.php:69
const ROLE_FOLDER_ID
Definition: constants.php:34

◆ getOperationsOnType()

ilRbacReview::getOperationsOnType ( int  $a_typ_id)

all possible operations of a type

Definition at line 742 of file class.ilRbacReview.php.

References $res, and ILIAS\Repository\int().

Referenced by getOperationsOnTypeString().

742  : array
743  {
744  $query = 'SELECT ta.ops_id FROM rbac_ta ta JOIN rbac_operations o ON ta.ops_id = o.ops_id ' .
745  'WHERE typ_id = ' . $this->db->quote($a_typ_id, 'integer') . ' ' .
746  'ORDER BY op_order';
747 
748  $res = $this->db->query($query);
749  $ops_id = [];
750  while ($row = $this->db->fetchObject($res)) {
751  $ops_id[] = (int) $row->ops_id;
752  }
753  return $ops_id;
754  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOperationsOnTypeString()

ilRbacReview::getOperationsOnTypeString ( string  $a_type)

all possible operations of a type

Definition at line 759 of file class.ilRbacReview.php.

References $res, ilDBConstants\FETCHMODE_OBJECT, and getOperationsOnType().

759  : array
760  {
761  $query = "SELECT * FROM object_data WHERE type = 'typ' AND title = " . $this->db->quote($a_type, 'text') . " ";
762  $res = $this->db->query($query);
763  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
764  return $this->getOperationsOnType((int) $row->obj_id);
765  }
766  return [];
767  }
getOperationsOnType(int $a_typ_id)
all possible operations of a type
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:

◆ getParentRoleIds()

ilRbacReview::getParentRoleIds ( int  $a_endnode_id,
bool  $a_templates = false 
)

Get an array of parent role ids of all parent roles, if last parameter is set true you get also all parent templates.

Parameters
intref_id of an object which is end node
booltrue for role templates (default: false)
Returns
array array(role_ids => role_data)
Todo:
move tree to construct. Currently this is not possible due to init sequence

Definition at line 122 of file class.ilRbacReview.php.

References $DIC, __getParentRoles(), and ROLE_FOLDER_ID.

Referenced by ilContainerGUI\performPasteIntoMultipleObjectsObject(), and ilPermissionGUI\savePermissions().

122  : array
123  {
124  global $DIC;
125 
126  $tree = $DIC->repositoryTree();
127 
128  $pathIds = $tree->getPathId($a_endnode_id);
129 
130  // add system folder since it may not in the path
131  //$pathIds[0] = SYSTEM_FOLDER_ID;
132  $pathIds[0] = ROLE_FOLDER_ID;
133  return $this->__getParentRoles($pathIds, $a_templates);
134  }
global $DIC
Definition: feed.php:28
__getParentRoles(array $a_path, bool $a_templates)
Note: This function performs faster than the new getParentRoles function, because it uses database in...
const ROLE_FOLDER_ID
Definition: constants.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRoleFolderOfRole()

ilRbacReview::getRoleFolderOfRole ( int  $a_role_id)

Definition at line 1325 of file class.ilRbacReview.php.

References $res, ilObject\_lookupType(), and ilDBConstants\FETCHMODE_OBJECT.

Referenced by isSystemGeneratedRole().

1325  : int
1326  {
1327  if (ilObject::_lookupType($a_role_id) == 'role') {
1328  $and = ('AND assign = ' . $this->db->quote('y', 'text'));
1329  } else {
1330  $and = '';
1331  }
1332 
1333  $query = 'SELECT * FROM rbac_fa ' .
1334  'WHERE rol_id = ' . $this->db->quote($a_role_id, 'integer') . ' ' .
1335  $and;
1336  $res = $this->db->query($query);
1337  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1338  return (int) $row->parent;
1339  }
1340  return 0;
1341  }
$res
Definition: ltiservices.php:69
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRoleListByObject()

ilRbacReview::getRoleListByObject ( int  $a_ref_id,
bool  $a_templates = false 
)

Returns a list of roles in an container.

Returns
list<RoleListEntry>

Definition at line 140 of file class.ilRbacReview.php.

References $res, __setRoleType(), __setTemplateFilter(), and ILIAS\Repository\int().

Referenced by __getParentRoles(), and isSystemGeneratedRole().

140  : array
141  {
142  $role_list = [];
143  $where = $this->__setTemplateFilter($a_templates);
144 
145  $query = "SELECT * FROM object_data " .
146  "JOIN rbac_fa ON obj_id = rol_id " .
147  $where .
148  "AND object_data.obj_id = rbac_fa.rol_id " .
149  "AND rbac_fa.parent = " . $this->db->quote($a_ref_id, 'integer') . " ";
150 
151  $res = $this->db->query($query);
152  while ($row = $this->db->fetchAssoc($res)) {
153  $row["desc"] = $row["description"];
154  $row["user_id"] = (int) $row["owner"];
155  $row['obj_id'] = (int) $row['obj_id'];
156  $row['rol_id'] = (int) $row['rol_id'];
157  $row['parent'] = (int) $row['parent'];
158  $role_list[] = $row;
159  }
160 
161  return $this->__setRoleType($role_list);
162  }
$res
Definition: ltiservices.php:69
__setTemplateFilter(bool $a_templates)
get roles and templates or only roles; returns string for where clause
__setRoleType(array $a_role_list)
computes role type in role list array: global: roles in ROLE_FOLDER_ID local: assignable roles in oth...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRoleOperationsOnObject()

ilRbacReview::getRoleOperationsOnObject ( int  $a_role_id,
int  $a_ref_id 
)

Definition at line 723 of file class.ilRbacReview.php.

References $res.

Referenced by ilPermissionGUI\savePermissions().

723  : array
724  {
725  $query = "SELECT ops_id FROM rbac_pa " .
726  "WHERE rol_id = " . $this->db->quote($a_role_id, 'integer') . " " .
727  "AND ref_id = " . $this->db->quote($a_ref_id, 'integer') . " ";
728 
729  $res = $this->db->query($query);
730  $ops = [];
731  while ($row = $this->db->fetchObject($res)) {
732  if ($row->ops_id !== ':') {
733  $ops = unserialize($row->ops_id);
734  }
735  }
736  return $ops;
737  }
$res
Definition: ltiservices.php:69
+ Here is the caller graph for this function:

◆ getRolesByFilter()

ilRbacReview::getRolesByFilter ( int  $a_filter = 0,
int  $a_user_id = 0,
string  $title_filter = '' 
)
Returns
Generator<RoleListEntry>

Definition at line 851 of file class.ilRbacReview.php.

References $res, assignedRoles(), ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from(), getAssignableRolesGenerator(), getGlobalRoles(), ILIAS\Repository\int(), and setRoleTypeAndProtection().

851  : Generator
852  {
853  $assign = "y";
854  switch ($a_filter) {
855  case self::FILTER_ALL:
856  return yield from $this->getAssignableRolesGenerator(true, true, $title_filter);
857 
858  case self::FILTER_ALL_GLOBAL:
859  $where = 'WHERE ' . $this->db->in('rbac_fa.rol_id', $this->getGlobalRoles(), false, 'integer') . ' ';
860  break;
861 
862  case self::FILTER_ALL_LOCAL:
863  case self::FILTER_INTERNAL:
864  case self::FILTER_NOT_INTERNAL:
865  $where = 'WHERE ' . $this->db->in('rbac_fa.rol_id', $this->getGlobalRoles(), true, 'integer');
866  break;
867 
868  case self::FILTER_TEMPLATES:
869  $where = "WHERE object_data.type = 'rolt'";
870  $assign = "n";
871  break;
872 
873  case 0:
874  default:
875  if (!$a_user_id) {
876  return;
877  }
878 
879  $where = 'WHERE ' . $this->db->in(
880  'rbac_fa.rol_id',
881  $this->assignedRoles($a_user_id),
882  false,
883  'integer'
884  ) . ' ';
885  break;
886  }
887 
888  $query = "SELECT * FROM object_data " .
889  "JOIN rbac_fa ON obj_id = rol_id " .
890  $where .
891  "AND rbac_fa.assign = " . $this->db->quote($assign, 'text') . " ";
892 
893  if (strlen($title_filter)) {
894  $query .= (' AND ' . $this->db->like(
895  'title',
896  'text',
897  '%' . $title_filter . '%'
898  ));
899  }
900 
901  $res = $this->db->query($query);
902  while ($row = $this->db->fetchAssoc($res)) {
903  $row['title'] = $row['title'] ?? '';
904  $prefix = substr($row['title'], 0, 3) == "il_";
905 
906  // all (assignable) internal local roles only
907  if ($a_filter == 4 && !$prefix) {
908  continue;
909  }
910 
911  // all (assignable) non internal local roles only
912  if ($a_filter == 5 && $prefix) {
913  continue;
914  }
915 
916  $row['description'] = $row['description'] ?? '';
917  $row["desc"] = $row["description"];
918  $row["user_id"] = (int) $row["owner"];
919  $row['obj_id'] = (int) $row['obj_id'];
920  $row['rol_id'] = (int) $row['rol_id'];
921  $row['parent'] = (int) $row['parent'];
922 
923  yield $this->setRoleTypeAndProtection($row);
924  }
925  }
$res
Definition: ltiservices.php:69
setRoleTypeAndProtection(array $role_list_entry)
getGlobalRoles()
get only &#39;global&#39; roles
getAssignableRolesGenerator(bool $a_templates=false, bool $a_internal_roles=false, string $title_filter='')
assignedRoles(int $a_usr_id)
get all assigned roles to a given user
+ Here is the call graph for this function:

◆ getRolesForIDs()

ilRbacReview::getRolesForIDs ( array  $role_ids,
bool  $use_templates 
)

Definition at line 1226 of file class.ilRbacReview.php.

References $res, __setRoleType(), __setTemplateFilter(), and ILIAS\Repository\int().

1226  : array
1227  {
1228  $where = $this->__setTemplateFilter($use_templates);
1229  $query = "SELECT * FROM object_data " .
1230  "JOIN rbac_fa ON object_data.obj_id = rbac_fa.rol_id " .
1231  $where .
1232  "AND rbac_fa.assign = 'y' " .
1233  'AND ' . $this->db->in('object_data.obj_id', $role_ids, false, 'integer');
1234 
1235  $res = $this->db->query($query);
1236  $role_list = [];
1237  while ($row = $this->db->fetchAssoc($res)) {
1238  $row["desc"] = $row["description"];
1239  $row["user_id"] = (int) $row["owner"];
1240  $role_list[] = $row;
1241  }
1242  return $this->__setRoleType($role_list);
1243  }
$res
Definition: ltiservices.php:69
__setTemplateFilter(bool $a_templates)
get roles and templates or only roles; returns string for where clause
__setRoleType(array $a_role_list)
computes role type in role list array: global: roles in ROLE_FOLDER_ID local: assignable roles in oth...
+ Here is the call graph for this function:

◆ getRolesOfObject()

ilRbacReview::getRolesOfObject ( int  $a_ref_id,
bool  $a_assignable_only = false 
)

Get roles of object.

Definition at line 501 of file class.ilRbacReview.php.

References $res, and ILIAS\Repository\int().

501  : array
502  {
503  $and = '';
504  if ($a_assignable_only === true) {
505  $and = 'AND assign = ' . $this->db->quote('y', 'text');
506  }
507  $query = "SELECT rol_id FROM rbac_fa " .
508  "WHERE parent = " . $this->db->quote($a_ref_id, 'integer') . " " .
509  $and;
510 
511  $res = $this->db->query($query);
512 
513  $role_ids = [];
514  while ($row = $this->db->fetchObject($res)) {
515  $role_ids[] = (int) $row->rol_id;
516  }
517  return $role_ids;
518  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:

◆ getRolesOfRoleFolder()

ilRbacReview::getRolesOfRoleFolder ( int  $a_ref_id,
bool  $a_nonassignable = true 
)

get all roles of a role folder including linked local roles that are created due to stopped inheritance returns an array with role ids public

Parameters
intref_id of object
boolif false only get true local roles
Returns
int[] Array with rol_ids
Deprecated:
since version 4.5.0
Todo:
refactor rolf => RENAME

Definition at line 530 of file class.ilRbacReview.php.

References $res, and ILIAS\Repository\int().

Referenced by ilObjSessionGUI\getDefaultMemberRole(), getGlobalRoles(), getGlobalRolesArray(), getLocalPolicies(), getLocalRoles(), and ilObjSessionGUI\getLocalRoles().

530  : array
531  {
532  $and = '';
533  if ($a_nonassignable === false) {
534  $and = " AND assign='y'";
535  }
536 
537  $query = "SELECT rol_id FROM rbac_fa " .
538  "WHERE parent = " . $this->db->quote($a_ref_id, 'integer') . " " .
539  $and;
540 
541  $res = $this->db->query($query);
542  $rol_id = [];
543  while ($row = $this->db->fetchObject($res)) {
544  $rol_id[] = (int) $row->rol_id;
545  }
546 
547  return $rol_id;
548  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTypeId()

ilRbacReview::getTypeId ( string  $a_type)

Definition at line 927 of file class.ilRbacReview.php.

References $q, $r, and ilDBConstants\FETCHMODE_OBJECT.

927  : int
928  {
929  $q = "SELECT obj_id FROM object_data " .
930  "WHERE title=" . $this->db->quote($a_type, 'text') . " AND type='typ'";
931  $r = $this->db->query($q);
932  while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
933  return (int) $row->obj_id;
934  }
935  return 0;
936  }
$q
Definition: shib_logout.php:21
$r

◆ getUserPermissionsOnObject()

ilRbacReview::getUserPermissionsOnObject ( int  $a_user_id,
int  $a_ref_id 
)

Get all user permissions on an object.

Definition at line 1346 of file class.ilRbacReview.php.

References $res.

1346  : array
1347  {
1348  $query = "SELECT ops_id FROM rbac_pa JOIN rbac_ua " .
1349  "ON (rbac_pa.rol_id = rbac_ua.rol_id) " .
1350  "WHERE rbac_ua.usr_id = " . $this->db->quote($a_user_id, 'integer') . " " .
1351  "AND rbac_pa.ref_id = " . $this->db->quote($a_ref_id, 'integer') . " ";
1352 
1353  $res = $this->db->query($query);
1354  $all_ops = [];
1355  while ($row = $this->db->fetchObject($res)) {
1356  $ops = unserialize($row->ops_id);
1357  $all_ops = array_merge($all_ops, $ops);
1358  }
1359  $all_ops = array_unique($all_ops);
1360 
1361  $set = $this->db->query("SELECT operation FROM rbac_operations " .
1362  " WHERE " . $this->db->in("ops_id", $all_ops, false, "integer"));
1363  $perms = [];
1364  while ($rec = $this->db->fetchAssoc($set)) {
1365  $perms[] = $rec["operation"];
1366  }
1367  return $perms;
1368  }
$res
Definition: ltiservices.php:69

◆ hasMultipleAssignments()

ilRbacReview::hasMultipleAssignments ( int  $a_role_id)

Definition at line 463 of file class.ilRbacReview.php.

References $res.

463  : bool
464  {
465  $query = "SELECT * FROM rbac_fa WHERE rol_id = " . $this->db->quote($a_role_id, 'integer') . ' ' .
466  "AND assign = " . $this->db->quote('y', 'text');
467  $res = $this->db->query($query);
468  return $res->numRows() > 1;
469  }
$res
Definition: ltiservices.php:69

◆ isAssignable()

ilRbacReview::isAssignable ( int  $a_rol_id,
int  $a_ref_id 
)

Check if its possible to assign users.

Definition at line 446 of file class.ilRbacReview.php.

References $res, and SYSTEM_ROLE_ID.

Referenced by getLocalRoles(), isDeleteable(), ilRecommendedContentRoleConfigGUI\listItems(), and ilPermissionGUI\savePermissions().

446  : bool
447  {
448  // exclude system role from rbac
449  if ($a_rol_id == SYSTEM_ROLE_ID) {
450  return true;
451  }
452 
453  $query = "SELECT * FROM rbac_fa " .
454  "WHERE rol_id = " . $this->db->quote($a_rol_id, 'integer') . " " .
455  "AND parent = " . $this->db->quote($a_ref_id, 'integer') . " ";
456  $res = $this->db->query($query);
457  while ($row = $this->db->fetchObject($res)) {
458  return $row->assign == 'y';
459  }
460  return false;
461  }
$res
Definition: ltiservices.php:69
const SYSTEM_ROLE_ID
Definition: constants.php:29
+ Here is the caller graph for this function:

◆ isAssigned()

ilRbacReview::isAssigned ( int  $a_usr_id,
int  $a_role_id 
)

check if a specific user is assigned to specific role

Definition at line 368 of file class.ilRbacReview.php.

References $res, and ilDBConstants\T_INTEGER.

Referenced by ilPortfolioAccessHandler\checkAccessOfUser(), and ilWorkspaceAccessHandler\checkAccessOfUser().

368  : bool
369  {
370  if (isset(self::$is_assigned_cache[$a_role_id][$a_usr_id])) {
371  return self::$is_assigned_cache[$a_role_id][$a_usr_id];
372  }
373  // Quickly determine if user is assigned to a role
374  $this->db->setLimit(1, 0);
375  $query = "SELECT usr_id FROM rbac_ua WHERE " .
376  "rol_id= " . $this->db->quote($a_role_id, 'integer') . " " .
377  "AND usr_id= " . $this->db->quote($a_usr_id, ilDBConstants::T_INTEGER);
378  $res = $this->db->query($query);
379  $is_assigned = $res->numRows() == 1;
380  self::$is_assigned_cache[$a_role_id][$a_usr_id] = $is_assigned;
381  return $is_assigned;
382  }
$res
Definition: ltiservices.php:69
+ Here is the caller graph for this function:

◆ isAssignedToAtLeastOneGivenRole()

ilRbacReview::isAssignedToAtLeastOneGivenRole ( int  $a_usr_id,
array  $a_role_ids 
)

check if a specific user is assigned to at least one of the given role ids.

This function is used to quickly check whether a user is member of a course or a group.

Parameters
intusr_id
int[]role_ids

Definition at line 392 of file class.ilRbacReview.php.

References $DIC, $res, and ilDBConstants\T_INTEGER.

392  : bool
393  {
394  global $DIC;
395 
396  $this->db = $DIC['ilDB'];
397 
398  $this->db->setLimit(1, 0);
399  $query = "SELECT usr_id FROM rbac_ua WHERE " .
400  $this->db->in('rol_id', $a_role_ids, false, 'integer') .
401  " AND usr_id= " . $this->db->quote($a_usr_id, ilDBConstants::T_INTEGER);
402  $res = $this->db->query($query);
403 
404  return $this->db->numRows($res) == 1;
405  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28

◆ isBlockedAtPosition()

ilRbacReview::isBlockedAtPosition ( int  $a_role_id,
int  $a_ref_id 
)

Definition at line 1040 of file class.ilRbacReview.php.

References $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilPermissionGUI\getModifiedBlockedSettings(), isBlockedInUpperContext(), and ilPermissionGUI\savePermissions().

1040  : bool
1041  {
1042  $query = 'SELECT blocked from rbac_fa ' .
1043  'WHERE rol_id = ' . $this->db->quote($a_role_id, 'integer') . ' ' .
1044  'AND parent = ' . $this->db->quote($a_ref_id, 'integer');
1045  $res = $this->db->query($query);
1046  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1047  return (bool) $row->blocked;
1048  }
1049  return false;
1050  }
$res
Definition: ltiservices.php:69
+ Here is the caller graph for this function:

◆ isBlockedInUpperContext()

ilRbacReview::isBlockedInUpperContext ( int  $a_role_id,
int  $a_ref_id 
)

Check if role is blocked in upper context.

Todo:
move tree to construct.

Currently this is not possible due to init sequence

Definition at line 1056 of file class.ilRbacReview.php.

References $DIC, $res, ilDBConstants\FETCHMODE_OBJECT, ILIAS\Repository\int(), and isBlockedAtPosition().

1056  : bool
1057  {
1058  global $DIC;
1059 
1060  $tree = $DIC['tree'];
1061 
1062  if ($this->isBlockedAtPosition($a_role_id, $a_ref_id)) {
1063  return false;
1064  }
1065  $query = 'SELECT parent from rbac_fa ' .
1066  'WHERE rol_id = ' . $this->db->quote($a_role_id, 'integer') . ' ' .
1067  'AND blocked = ' . $this->db->quote(1, 'integer');
1068  $res = $this->db->query($query);
1069 
1070  $parent_ids = [];
1071  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1072  $parent_ids[] = (int) $row->parent;
1073  }
1074 
1075  foreach ($parent_ids as $parent_id) {
1076  if ($tree->isGrandChild($parent_id, $a_ref_id)) {
1077  return true;
1078  }
1079  }
1080  return false;
1081  }
$res
Definition: ltiservices.php:69
isBlockedAtPosition(int $a_role_id, int $a_ref_id)
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ isDeleteable()

ilRbacReview::isDeleteable ( int  $a_role_id,
int  $a_rolf_id 
)

Check if role is deleteable at a specific position.

Definition at line 1275 of file class.ilRbacReview.php.

References ilObject\_lookupTitle(), ANONYMOUS_ROLE_ID, isAssignable(), and SYSTEM_ROLE_ID.

1275  : bool
1276  {
1277  if (!$this->isAssignable($a_role_id, $a_rolf_id)) {
1278  return false;
1279  }
1280  if ($a_role_id == SYSTEM_ROLE_ID or $a_role_id == ANONYMOUS_ROLE_ID) {
1281  return false;
1282  }
1283  if (substr(ilObject::_lookupTitle($a_role_id), 0, 3) == 'il_') {
1284  return false;
1285  }
1286  return true;
1287  }
const SYSTEM_ROLE_ID
Definition: constants.php:29
static _lookupTitle(int $obj_id)
const ANONYMOUS_ROLE_ID
Definition: constants.php:28
isAssignable(int $a_rol_id, int $a_ref_id)
Check if its possible to assign users.
+ Here is the call graph for this function:

◆ isDeleted()

ilRbacReview::isDeleted ( int  $a_node_id)

Checks if a rolefolder is set as deleted (negative tree_id)

Todo:
delete this method

Definition at line 822 of file class.ilRbacReview.php.

References $message, $q, $r, ilDBConstants\FETCHMODE_OBJECT, and ilDBConstants\T_INTEGER.

Referenced by isRoleDeleted().

822  : bool
823  {
824  $q = "SELECT tree FROM tree WHERE child =" . $this->db->quote($a_node_id, ilDBConstants::T_INTEGER) . " ";
825  $r = $this->db->query($q);
826  $row = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
827 
828  if (!$row) {
829  $message = sprintf(
830  '%s::isDeleted(): Role folder with ref_id %s not found!',
831  get_class($this),
832  $a_node_id
833  );
834  $this->log->warning($message);
835  return true;
836  }
837  return $row->tree < 0;
838  }
$q
Definition: shib_logout.php:21
$message
Definition: xapiexit.php:32
$r
+ Here is the caller graph for this function:

◆ isGlobalRole()

ilRbacReview::isGlobalRole ( int  $a_role_id)

Check if role is a global role.

Definition at line 843 of file class.ilRbacReview.php.

References getGlobalRoles().

843  : bool
844  {
845  return in_array($a_role_id, $this->getGlobalRoles());
846  }
getGlobalRoles()
get only &#39;global&#39; roles
+ Here is the call graph for this function:

◆ isProtected()

ilRbacReview::isProtected ( int  $a_ref_id,
int  $a_role_id 
)

ref_id not used yet.

Protected permission acts 'global' for each role,

Definition at line 1027 of file class.ilRbacReview.php.

References $res, ilDBConstants\FETCHMODE_OBJECT, and ilDBConstants\T_INTEGER.

Referenced by ilPermissionGUI\savePermissions().

1027  : bool
1028  {
1029  $query = 'SELECT protected FROM rbac_fa ' .
1030  'WHERE rol_id = ' . $this->db->quote($a_role_id, ilDBConstants::T_INTEGER);
1031  $res = $this->db->query($query);
1032  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1033  if ($row->protected === 'y') {
1034  return true;
1035  }
1036  }
1037  return false;
1038  }
$res
Definition: ltiservices.php:69
+ Here is the caller graph for this function:

◆ isRoleAssignedToObject()

ilRbacReview::isRoleAssignedToObject ( int  $a_role_id,
int  $a_parent_id 
)

Check if role is assigned to an object.

Definition at line 620 of file class.ilRbacReview.php.

References $res.

620  : bool
621  {
622  $query = 'SELECT * FROM rbac_fa ' .
623  'WHERE rol_id = ' . $this->db->quote($a_role_id, 'integer') . ' ' .
624  'AND parent = ' . $this->db->quote($a_parent_id, 'integer');
625  $res = $this->db->query($query);
626  return (bool) $res->numRows();
627  }
$res
Definition: ltiservices.php:69

◆ isRoleDeleted()

ilRbacReview::isRoleDeleted ( int  $a_role_id)

return if role is only attached to deleted role folders

Definition at line 1210 of file class.ilRbacReview.php.

References getFoldersAssignedToRole(), and isDeleted().

1210  : bool
1211  {
1212  $rolf_list = $this->getFoldersAssignedToRole($a_role_id, false);
1213  $deleted = true;
1214  if ($rolf_list !== []) {
1215  foreach ($rolf_list as $rolf) {
1216  // only list roles that are not set to status "deleted"
1217  if (!$this->isDeleted($rolf)) {
1218  $deleted = false;
1219  break;
1220  }
1221  }
1222  }
1223  return $deleted;
1224  }
isDeleted(int $a_node_id)
Checks if a rolefolder is set as deleted (negative tree_id)
getFoldersAssignedToRole(int $a_rol_id, bool $a_assignable=false)
Returns an array of objects assigned to a role.
+ Here is the call graph for this function:

◆ isSystemGeneratedRole()

ilRbacReview::isSystemGeneratedRole ( int  $a_role_id)

Check if the role is system generate role or role template.

Definition at line 1292 of file class.ilRbacReview.php.

References $DIC, $ref_id, ilObject\_lookupTitle(), getRoleFolderOfRole(), getRoleListByObject(), and ROLE_FOLDER_ID.

1292  : bool
1293  {
1294  $title = ilObject::_lookupTitle($a_role_id);
1295  return substr($title, 0, 3) == 'il_';
1296  }
static _lookupTitle(int $obj_id)
+ Here is the call graph for this function:

◆ lookupCreateOperationIds()

static ilRbacReview::lookupCreateOperationIds ( array  $a_type_arr)
static

Lookup operation ids.

Parameters
array$a_type_arre.g array('cat','crs','grp'). The operation name (e.g. 'create_cat') is generated automatically
Returns
int[] Array with operation ids

Definition at line 994 of file class.ilRbacReview.php.

References $DIC, $ilDB, $res, and ILIAS\Repository\int().

Referenced by ilObjectXMLWriter\appendOperations(), ilObjectRoleTemplatePermissionTableGUI\parse(), ilObjectRolePermissionTableGUI\parse(), and ilPermissionGUI\savePermissions().

994  : array
995  {
996  global $DIC;
997 
998  $ilDB = $DIC->database();
999 
1000  $operations = [];
1001  foreach ($a_type_arr as $type) {
1002  $operations[] = ('create_' . $type);
1003  }
1004 
1005  if ($operations === []) {
1006  return [];
1007  }
1008 
1009  $query = 'SELECT ops_id, operation FROM rbac_operations ' .
1010  'WHERE ' . $ilDB->in('operation', $operations, false, 'text');
1011 
1012  $res = $ilDB->query($query);
1013 
1014  $ops_ids = [];
1015  while ($row = $ilDB->fetchObject($res)) {
1016  $type_arr = explode('_', $row->operation);
1017  $type = $type_arr[1];
1018 
1019  $ops_ids[$type] = (int) $row->ops_id;
1020  }
1021  return $ops_ids;
1022  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ roleExists()

ilRbacReview::roleExists ( string  $a_title,
int  $a_id = 0 
)

Checks if a role already exists.

Role title should be unique public

Parameters
stringrole title
?intobj_id of role to exclude in the check. Commonly this is the current role you want to edit
Returns
bool

Definition at line 70 of file class.ilRbacReview.php.

References $q, $r, ilDBConstants\FETCHMODE_OBJECT, and ilDBConstants\T_TEXT.

70  : ?int
71  {
72  $clause = ($a_id) ? " AND obj_id != " . $this->db->quote($a_id, ilDBConstants::T_TEXT) . " " : "";
73 
74  $q = "SELECT DISTINCT(obj_id) obj_id FROM object_data " .
75  "WHERE title =" . $this->db->quote($a_title, ilDBConstants::T_TEXT) . " " .
76  "AND type IN('role','rolt')" .
77  $clause . " ";
78  $r = $this->db->query($q);
79  while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
80  return (int) $row->obj_id;
81  }
82  return null;
83  }
$q
Definition: shib_logout.php:21
$r

◆ setAssignedCacheEntry()

ilRbacReview::setAssignedCacheEntry ( int  $a_role_id,
int  $a_user_id,
bool  $a_value 
)

set entry of assigned_chache

Definition at line 1373 of file class.ilRbacReview.php.

1373  : void
1374  {
1375  self::$is_assigned_cache[$a_role_id][$a_user_id] = $a_value;
1376  }

◆ setRoleTypeAndProtection()

ilRbacReview::setRoleTypeAndProtection ( array  $role_list_entry)
private

Definition at line 293 of file class.ilRbacReview.php.

References buildProtectionByStringValue(), and buildRoleType().

Referenced by __setRoleType(), getAssignableRolesGenerator(), and getRolesByFilter().

293  : array
294  {
295  $role_list_entry['role_type'] = $this->buildRoleType($role_list_entry);
296  $role_list_entry['protected'] = $this->buildProtectionByStringValue($role_list_entry['protected']);
297  return $role_list_entry;
298  }
buildRoleType(array $role_list_entry)
buildProtectionByStringValue(string $value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $_opsCache

array ilRbacReview::$_opsCache = null
staticprivate

Definition at line 43 of file class.ilRbacReview.php.

◆ $assigned_users_cache

array ilRbacReview::$assigned_users_cache = []
staticprotected

Definition at line 45 of file class.ilRbacReview.php.

◆ $db

ilDBInterface ilRbacReview::$db
protected

Definition at line 49 of file class.ilRbacReview.php.

◆ $is_assigned_cache

array ilRbacReview::$is_assigned_cache = []
staticprotected

Definition at line 46 of file class.ilRbacReview.php.

◆ $log

ilLogger ilRbacReview::$log
protected

Definition at line 48 of file class.ilRbacReview.php.

◆ FILTER_ALL

const ilRbacReview::FILTER_ALL = 1

Definition at line 35 of file class.ilRbacReview.php.

Referenced by ilRoleTableGUI\initFilter(), and ilRoleTableGUI\parse().

◆ FILTER_ALL_GLOBAL

const ilRbacReview::FILTER_ALL_GLOBAL = 2

◆ FILTER_ALL_LOCAL

const ilRbacReview::FILTER_ALL_LOCAL = 3

Definition at line 37 of file class.ilRbacReview.php.

Referenced by ilRoleTableGUI\initFilter().

◆ FILTER_INTERNAL

const ilRbacReview::FILTER_INTERNAL = 4

Definition at line 38 of file class.ilRbacReview.php.

Referenced by ilRoleTableGUI\initFilter().

◆ FILTER_NOT_INTERNAL

const ilRbacReview::FILTER_NOT_INTERNAL = 5

Definition at line 39 of file class.ilRbacReview.php.

Referenced by ilRoleTableGUI\initFilter().

◆ FILTER_TEMPLATES

const ilRbacReview::FILTER_TEMPLATES = 6

Definition at line 40 of file class.ilRbacReview.php.

Referenced by ilRoleTableGUI\initFilter().


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