ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilObjRole Class Reference

Class ilObjRole. More...

+ Inheritance diagram for ilObjRole:
+ Collaboration diagram for ilObjRole:

Public Member Functions

 __construct ($a_id=0, $a_call_by_reference=false)
 Constructor public. More...
 
 validate ()
 Validate role data. More...
 
 getPresentationTitle ()
 return translated title for autogenerated roles More...
 
 toggleAssignUsersStatus ($a_assign_users)
 
 getAssignUsersStatus ()
 
 read ()
 loads "role" from database private More...
 
 assignData ($a_data)
 loads a record "role" from array public More...
 
 update ()
 updates a record "role" and write it into database public More...
 
 create ()
 create More...
 
 setAllowRegister ($a_allow_register)
 set allow_register of role More...
 
 getAllowRegister ()
 get allow_register More...
 
 setDiskQuota ($a_disk_quota)
 Sets the minimal disk quota imposed by this role. More...
 
 getDiskQuota ()
 Gets the minimal disk quota imposed by this role. More...
 
 setPersonalWorkspaceDiskQuota ($a_disk_quota)
 Sets the minimal personal workspace disk quota imposed by this role. More...
 
 getPersonalWorkspaceDiskQuota ()
 Gets the minimal personal workspace disk quota imposed by this role. More...
 
 setParent ($a_parent_ref)
 set reference id of parent object this is neccessary for non RBAC protected objects!!! More...
 
 getParent ()
 get reference id of parent object More...
 
 delete ()
 delete role and all related data More...
 
 getCountMembers ()
 
 __getPermissionDefinitions ()
 
 changeExistingObjects ($a_start_node, $a_mode, $a_filter, $a_exclusion_filter=array(), $a_operation_mode=self::MODE_READ_OPERATIONS, $a_operation_stack=[])
 Change existing objects. More...
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 setOfflineStatus ($a_status)
 Set offline status. More...
 
 getOfflineStatus ()
 Get offline status. More...
 
 supportsOfflineHandling ()
 Check whether object supports offline handling. More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static createDefaultRole ($a_title, $a_description, $a_tpl_name, $a_ref_id)
 
static _getAssignUsersStatus ($a_role_id)
 
static _lookupRegisterAllowed ()
 get all roles that are activated in user registration More...
 
static _lookupAllowRegister ($a_role_id)
 check whether role is allowed in user registration or not More...
 
static _getTranslation ($a_role_title)
 
static _removeObjectId ($a_role_title)
 
static _updateAuthMode ($a_roles)
 
static _getAuthMode ($a_role_id)
 
static _getRolesByAuthMode ($a_auth_mode)
 Get roles by auth mode. More...
 
static _resetAuthMode ($a_auth_mode)
 Reset auth mode to default. More...
 
static isAutoGenerated ($a_role_id)
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static lookupOfflineStatus ($a_obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Data Fields

const MODE_PROTECTED_DELETE_LOCAL_POLICIES = 1
 
const MODE_PROTECTED_KEEP_LOCAL_POLICIES = 2
 
const MODE_UNPROTECTED_DELETE_LOCAL_POLICIES = 3
 
const MODE_UNPROTECTED_KEEP_LOCAL_POLICIES = 4
 
const MODE_ADD_OPERATIONS = 1
 
const MODE_READ_OPERATIONS = 2
 
const MODE_REMOVE_OPERATIONS = 3
 
 $parent
 
 $allow_register
 
 $assign_users
 
 $disk_quota
 The disk quota in bytes. More...
 
 $wsp_disk_quota
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 

Protected Member Functions

 deleteLocalPolicies ($a_start, $a_policies, $a_filter)
 Delete local policies. More...
 
 adjustPermissions ($a_mode, $a_nodes, $a_policies, $a_filter, $a_exclusion_filter=array(), $a_operation_mode=self::MODE_READ_OPERATIONS, $a_operation_stack=[])
 Adjust permissions. More...
 
 changeExistingObjectsGrantPermissions ($a_role_id, $a_permissions, $a_ref_id, $a_operation_mode)
 
 isHandledObjectType ($a_filter, $a_exclusion_filter, $a_type)
 Check if type is filterer. More...
 
 updateOperationStack (&$a_stack, $a_node, $a_init=false)
 Update operation stack. More...
 
 updatePolicyStack (&$a_stack, $a_node)
 Update policy stack. More...
 
 createPermissionIntersection ($policy_stack, $a_current_ops, $a_id, $a_type)
 Create course group permission intersection. More...
 

Private Attributes

 $logger = null
 

Additional Inherited Members

- Protected Attributes inherited from ilObject
 $objDefinition
 
 $db
 
 $log
 
 $error
 
 $tree
 
 $app_event_handler
 
 $rbacadmin
 
 $rbacreview
 

Detailed Description

Class ilObjRole.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 16 of file class.ilObjRole.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjRole::__construct (   $a_id = 0,
  $a_call_by_reference = false 
)

Constructor public.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

Definition at line 53 of file class.ilObjRole.php.

References $DIC.

54  {
55  global $DIC;
56 
57  $this->logger = $DIC->logger()->ac();
58  $this->type = "role";
59  $this->disk_quota = 0;
60  $this->wsp_disk_quota = 0;
61  parent::__construct($a_id, $a_call_by_reference);
62  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ __getPermissionDefinitions()

ilObjRole::__getPermissionDefinitions ( )

Definition at line 661 of file class.ilObjRole.php.

References $DIC, $ilDB, $info, ilObject\$lng, ilObject\$objDefinition, ilObject\$rbacreview, $txt, and ilObjectPlugin\lookupTxtById().

662  {
663  global $DIC;
664 
665  $ilDB = $DIC['ilDB'];
666  $lng = $DIC['lng'];
667  $objDefinition = $DIC['objDefinition'];
668  $rbacreview = $DIC['rbacreview'];
669 
670  $operation_info = $rbacreview->getOperationAssignment();
671  foreach ($operation_info as $info) {
672  if ($objDefinition->getDevMode($info['type'])) {
673  continue;
674  }
675  $rbac_objects[$info['typ_id']] = array("obj_id" => $info['typ_id'],
676  "type" => $info['type']);
677 
678  // handle plugin permission texts
679  $txt = $objDefinition->isPlugin($info['type'])
680  ? ilObjectPlugin::lookupTxtById($info['type'], $info['type'] . "_" . $info['operation'])
681  : $lng->txt($info['type'] . "_" . $info['operation']);
682  if (substr($info['operation'], 0, 7) == "create_" &&
683  $objDefinition->isPlugin(substr($info['operation'], 7))) {
684  $txt = ilObjectPlugin::lookupTxtById(substr($info['operation'], 7), $info['type'] . "_" . $info['operation']);
685  }
686  $rbac_operations[$info['typ_id']][$info['ops_id']] = array(
687  "ops_id" => $info['ops_id'],
688  "title" => $info['operation'],
689  "name" => $txt);
690  }
691  return array($rbac_objects,$rbac_operations);
692  }
static lookupTxtById($plugin_id, $lang_var)
global $DIC
Definition: saml.php:7
$txt
Definition: error.php:11
global $ilDB
$info
Definition: index.php:5
+ Here is the call graph for this function:

◆ _getAssignUsersStatus()

static ilObjRole::_getAssignUsersStatus (   $a_role_id)
static

Definition at line 154 of file class.ilObjRole.php.

References $DIC, $ilDB, $query, $res, and $row.

Referenced by ilRbacReview\getGlobalAssignableRoles(), ilObjUserFolderGUI\importUserRoleAssignmentObject(), ilSoapUserAdministration\importUsers(), ilObjUserFolderGUI\importUsersObject(), ilObjUserGUI\initCreate(), and ilSoapUserAdministration\isPermittedRole().

155  {
156  global $DIC;
157 
158  $ilDB = $DIC['ilDB'];
159 
160  $query = "SELECT assign_users FROM role_data WHERE role_id = " . $ilDB->quote($a_role_id, 'integer') . " ";
161  $res = $ilDB->query($query);
162  while ($row = $ilDB->fetchObject($res)) {
163  return $row->assign_users ? true : false;
164  }
165  return false;
166  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ _getAuthMode()

static ilObjRole::_getAuthMode (   $a_role_id)
static

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

References $DIC, $ilDB, $query, $res, and $row.

605  {
606  global $DIC;
607 
608  $ilDB = $DIC['ilDB'];
609 
610  $query = "SELECT auth_mode FROM role_data " .
611  "WHERE role_id= " . $ilDB->quote($a_role_id, 'integer') . " ";
612  $res = $ilDB->query($query);
613  $row = $ilDB->fetchAssoc($res);
614 
615  return $row['auth_mode'];
616  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB

◆ _getRolesByAuthMode()

static ilObjRole::_getRolesByAuthMode (   $a_auth_mode)
static

Get roles by auth mode.

public

Parameters
stringauth mode

Definition at line 625 of file class.ilObjRole.php.

References $DIC, $ilDB, $query, $res, and $row.

Referenced by ilRadiusSettings\read().

626  {
627  global $DIC;
628 
629  $ilDB = $DIC['ilDB'];
630 
631  $query = "SELECT * FROM role_data " .
632  "WHERE auth_mode = " . $ilDB->quote($a_auth_mode, 'text');
633  $res = $ilDB->query($query);
634  $roles = array();
635  while ($row = $ilDB->fetchObject($res)) {
636  $roles[] = $row->role_id;
637  }
638  return $roles;
639  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ _getTranslation()

static ilObjRole::_getTranslation (   $a_role_title)
static

Definition at line 518 of file class.ilObjRole.php.

References $DIC, and ilObject\$lng.

Referenced by ilCourseEditParticipantsTableGUI\__construct(), ilObjRoleGUI\addLocatorItems(), ilObjRoleGUI\adoptPermObject(), ilMailMemberSearchDataProvider\buildRoleTitle(), ilObjRoleFolderGUI\confirmDeleteObject(), ilObjectRolePermissionTableGUI\createTitle(), ilObjBlog\getAllLocalRoles(), ilObjectPermissionStatusGUI\getAssignedValidRoles(), ilObjectPermissionStatusGUI\getAvailableRolesTableData(), ilObjCourse\getLocalCourseRoles(), ilObjGroup\getLocalGroupRoles(), ilLearningSequenceRoles\getLocalLearningSequenceRoles(), ilObjLearningSequenceGUI\getLocalRoles(), ilObjGroupGUI\getLocalRoles(), ilObjCourseGUI\getLocalRoles(), ilSessionParticipantsTableGUI\getParentLocalRoles(), getPresentationTitle(), ilLTIProviderObjectSettingGUI\getRoleSelection(), ilObjBlog\getRolesWithContributeOrRedact(), ilDclTableViewEditFormGUI\initForm(), ilSettingsPermissionGUI\initPermissionForm(), ilPermissionGUI\initRoleForm(), ilRoleSelectionTableGUI\parse(), ilRoleTableGUI\parse(), ilObjUserGUI\roleassignmentObject(), ilPermissionGUI\showConfirmBlockRole(), and ilSoapRoleObjectXMLWriter\start().

519  {
520  global $DIC;
521 
522  $lng = $DIC['lng'];
523 
524  $role_title = self::_removeObjectId($a_role_title);
525 
526  if (preg_match("/^il_./", $role_title)) {
527  return $lng->txt($role_title);
528  }
529 
530  return $a_role_title;
531  }
global $DIC
Definition: saml.php:7
+ Here is the caller graph for this function:

◆ _lookupAllowRegister()

static ilObjRole::_lookupAllowRegister (   $a_role_id)
static

check whether role is allowed in user registration or not

Parameters
int$a_role_idrole id
Returns
boolean true if role is allowed in user registration

Definition at line 376 of file class.ilObjRole.php.

References $DIC, $ilDB, $query, and $res.

Referenced by ilRegistrationSettingsGUI\editRoles(), and ilAccountRegistrationGUI\saveForm().

377  {
378  global $DIC;
379 
380  $ilDB = $DIC['ilDB'];
381 
382  $query = "SELECT * FROM role_data " .
383  " WHERE role_id =" . $ilDB->quote($a_role_id, 'integer');
384 
385  $res = $ilDB->query($query);
386  if ($role_rec = $ilDB->fetchAssoc($res)) {
387  if ($role_rec["allow_register"]) {
388  return true;
389  }
390  }
391  return false;
392  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupRegisterAllowed()

static ilObjRole::_lookupRegisterAllowed ( )
static

get all roles that are activated in user registration

public

Returns
array array of int: role ids

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

References $DIC, $ilDB, $query, and $res.

Referenced by ilRegistrationSettingsGUI\__prepareAccessLimitationRoleList(), ilRegistrationSettingsGUI\__prepareRoleList(), ilUserProfile\addStandardFieldsToForm(), ilObjAuthSettingsGUI\authSettingsObject(), ilRegistrationSettingsGUI\editRoleAccessLimitations(), and ilRegistrationSettingsGUI\saveRoleAccessLimitations().

350  {
351  global $DIC;
352 
353  $ilDB = $DIC['ilDB'];
354 
355  $query = "SELECT * FROM role_data " .
356  "JOIN object_data ON object_data.obj_id = role_data.role_id " .
357  "WHERE allow_register = 1";
358  $res = $ilDB->query($query);
359 
360  $roles = array();
361  while ($role = $ilDB->fetchAssoc($res)) {
362  $roles[] = array("id" => $role["obj_id"],
363  "title" => $role["title"],
364  "auth_mode" => $role['auth_mode']);
365  }
366 
367  return $roles;
368  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ _removeObjectId()

static ilObjRole::_removeObjectId (   $a_role_title)
static

Definition at line 533 of file class.ilObjRole.php.

References $def, $DIC, ilObject\$lng, ilObject\$objDefinition, ilECSSetting\ecsConfigured(), ilECSUtils\getPossibleRemoteTypes(), ilObjectPlugin\lookupTxtById(), and ilUtil\sortArray().

Referenced by ilObjectRolePermissionTableGUI\createTitle(), and ilObjectPermissionStatusGUI\getAvailableRolesTableData().

534  {
535  $role_title_parts = explode('_', $a_role_title);
536 
537  $test2 = (int) $role_title_parts[3];
538  if ($test2 > 0) {
539  unset($role_title_parts[3]);
540  }
541 
542  return implode('_', $role_title_parts);
543  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _resetAuthMode()

static ilObjRole::_resetAuthMode (   $a_auth_mode)
static

Reset auth mode to default.

public

Parameters
stringauth mode

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

References $DIC, $ilDB, $query, and $res.

Referenced by ilRadiusSettings\save().

650  {
651  global $DIC;
652 
653  $ilDB = $DIC['ilDB'];
654 
655  $query = "UPDATE role_data SET auth_mode = 'default' WHERE auth_mode = " . $ilDB->quote($a_auth_mode, 'text');
656  $res = $ilDB->manipulate($query);
657  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ _updateAuthMode()

static ilObjRole::_updateAuthMode (   $a_roles)
static

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

References $DIC, $ilDB, $query, and $res.

Referenced by ilRadiusSettings\save(), and ilObjAuthSettingsGUI\updateAuthRolesObject().

591  {
592  global $DIC;
593 
594  $ilDB = $DIC['ilDB'];
595 
596  foreach ($a_roles as $role_id => $auth_mode) {
597  $query = "UPDATE role_data SET " .
598  "auth_mode= " . $ilDB->quote($auth_mode, 'text') . " " .
599  "WHERE role_id= " . $ilDB->quote($role_id, 'integer') . " ";
600  $res = $ilDB->manipulate($query);
601  }
602  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ adjustPermissions()

ilObjRole::adjustPermissions (   $a_mode,
  $a_nodes,
  $a_policies,
  $a_filter,
  $a_exclusion_filter = array(),
  $a_operation_mode = self::MODE_READ_OPERATIONS,
  $a_operation_stack = [] 
)
protected

Adjust permissions.

Parameters
int$a_mode
array$a_nodesarray of nodes
array$a_policiesarray of object ref ids
array$a_exclusion_filterof object types.
Returns

Definition at line 778 of file class.ilObjRole.php.

References $DIC, $GLOBALS, ilObject\$rbacadmin, ilObject\$rbacreview, ilObject\$tree, ilRbacLog\add(), changeExistingObjectsGrantPermissions(), createPermissionIntersection(), ilRbacLog\diffFaPa(), ilRbacLog\EDIT_TEMPLATE_EXISTING, ilRbacLog\gatherFaPa(), ilObject\getId(), ilRbacLog\isActive(), isHandledObjectType(), ilTree\RELATION_CHILD, ilTree\RELATION_EQUALS, ilTree\RELATION_NONE, ilTree\RELATION_PARENT, ilTree\RELATION_SIBLING, updateOperationStack(), and updatePolicyStack().

Referenced by changeExistingObjects().

779  {
780  global $DIC;
781 
782  $rbacadmin = $DIC['rbacadmin'];
783  $rbacreview = $DIC['rbacreview'];
784  $tree = $DIC['tree'];
785 
786  $operation_stack = array();
787  $policy_stack = array();
788  $node_stack = array();
789 
790  $start_node = current($a_nodes);
791  array_push($node_stack, $start_node);
792  $this->updatePolicyStack($policy_stack, $start_node['child']);
793 
794  if ($a_operation_mode == self::MODE_READ_OPERATIONS) {
795  $this->updateOperationStack($operation_stack, $start_node['child'], true);
796  }
797  else {
798  $operation_stack = $a_operation_stack;
799  }
800 
801  $this->logger->debug('adjust permissions operation stack');
802  $this->logger->dump($operation_stack);
803 
804  include_once "Services/AccessControl/classes/class.ilRbacLog.php";
805  $rbac_log_active = ilRbacLog::isActive();
806 
807  $local_policy = false;
808  foreach ($a_nodes as $node) {
809  $cmp_node = end($node_stack);
810  while ($relation = $tree->getRelationOfNodes($node, $cmp_node)) {
811  switch ($relation) {
814  $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Handling sibling/none relation.');
815  array_pop($operation_stack);
816  array_pop($policy_stack);
817  array_pop($node_stack);
818  $cmp_node = end($node_stack);
819  $local_policy = false;
820  break;
821 
825  default:
826  $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Handling child/equals/parent ' . $relation);
827  break 2;
828  }
829  }
830 
831  if ($local_policy) {
832  continue;
833  }
834 
835  // Start node => set permissions and continue
836  if ($node['child'] == $start_node['child']) {
837  if ($this->isHandledObjectType($a_filter, $a_exclusion_filter, $node['type'])) {
838  if ($rbac_log_active) {
839  $rbac_log_roles = $rbacreview->getParentRoleIds($node['child'], false);
840  $rbac_log_old = ilRbacLog::gatherFaPa($node['child'], array_keys($rbac_log_roles));
841  }
842 
843  // Set permissions
844  $perms = end($operation_stack);
846  $this->getId(),
847  (array) $perms[$node['type']],
848  $node['child'],
849  $a_operation_mode
850  );
851 
852  if ($rbac_log_active) {
853  $rbac_log_new = ilRbacLog::gatherFaPa($node['child'], array_keys($rbac_log_roles));
854  $rbac_log = ilRbacLog::diffFaPa($rbac_log_old, $rbac_log_new);
855  ilRbacLog::add(ilRbacLog::EDIT_TEMPLATE_EXISTING, $node['child'], $rbac_log);
856  }
857  }
858  continue;
859  }
860 
861  // Node has local policies => update permission stack and continue
862  if (in_array($node['child'], $a_policies) and ($node['child'] != SYSTEM_FOLDER_ID)) {
863  $local_policy = true;
864  $this->updatePolicyStack($policy_stack, $node['child']);
865  $this->updateOperationStack($operation_stack, $node['child']);
866  array_push($node_stack, $node);
867  continue;
868  }
869 
870  // Continue if this object type is not in filter
871  if (!$this->isHandledObjectType($a_filter, $a_exclusion_filter, $node['type'])) {
872  continue;
873  }
874 
875  if ($rbac_log_active) {
876  $rbac_log_roles = $rbacreview->getParentRoleIds($node['child'], false);
877  $rbac_log_old = ilRbacLog::gatherFaPa($node['child'], array_keys($rbac_log_roles));
878  }
879 
880  // Node is course => create course permission intersection
881  if (($a_mode == self::MODE_UNPROTECTED_DELETE_LOCAL_POLICIES or
882  $a_mode == self::MODE_UNPROTECTED_KEEP_LOCAL_POLICIES) and ($node['type'] == 'crs')) {
883  // Copy role permission intersection
884  $perms = end($operation_stack);
885  $this->createPermissionIntersection($policy_stack, $perms['crs'], $node['child'], $node['type']);
886  if ($this->updateOperationStack($operation_stack, $node['child'])) {
887  $this->updatePolicyStack($policy_stack, $node['child']);
888  array_push($node_stack, $node);
889  }
890  }
891 
892  // Node is group => create group permission intersection
893  if (($a_mode == self::MODE_UNPROTECTED_DELETE_LOCAL_POLICIES or
894  $a_mode == self::MODE_UNPROTECTED_KEEP_LOCAL_POLICIES) and ($node['type'] == 'grp')) {
895  // Copy role permission intersection
896  $perms = end($operation_stack);
897  $this->createPermissionIntersection($policy_stack, $perms['grp'], $node['child'], $node['type']);
898  if ($this->updateOperationStack($operation_stack, $node['child'])) {
899  $this->updatePolicyStack($policy_stack, $node['child']);
900  array_push($node_stack, $node);
901  }
902  }
903 
904  // Set permission
905  $perms = end($operation_stack);
906 
908  $this->getId(),
909  (array) $perms[$node['type']],
910  $node['child'],
911  $a_operation_mode
912  );
913  if ($rbac_log_active) {
914  $rbac_log_new = ilRbacLog::gatherFaPa($node['child'], array_keys($rbac_log_roles));
915  $rbac_log = ilRbacLog::diffFaPa($rbac_log_old, $rbac_log_new);
916  ilRbacLog::add(ilRbacLog::EDIT_TEMPLATE_EXISTING, $node['child'], $rbac_log);
917  }
918  }
919  }
global $DIC
Definition: saml.php:7
createPermissionIntersection($policy_stack, $a_current_ops, $a_id, $a_type)
Create course group permission intersection.
const RELATION_PARENT
static isActive()
updatePolicyStack(&$a_stack, $a_node)
Update policy stack.
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
static diffFaPa(array $a_old, array $a_new)
getId()
get object id public
isHandledObjectType($a_filter, $a_exclusion_filter, $a_type)
Check if type is filterer.
const RELATION_EQUALS
const RELATION_CHILD
const RELATION_NONE
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
changeExistingObjectsGrantPermissions($a_role_id, $a_permissions, $a_ref_id, $a_operation_mode)
const EDIT_TEMPLATE_EXISTING
updateOperationStack(&$a_stack, $a_node, $a_init=false)
Update operation stack.
const RELATION_SIBLING
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignData()

ilObjRole::assignData (   $a_data)

loads a record "role" from array public

Parameters
arrayroledata

Definition at line 198 of file class.ilObjRole.php.

References setAllowRegister(), ilObject\setDescription(), setDiskQuota(), setPersonalWorkspaceDiskQuota(), ilObject\setTitle(), ilUtil\stripSlashes(), and toggleAssignUsersStatus().

Referenced by read().

199  {
200  $this->setTitle(ilUtil::stripSlashes($a_data["title"]));
201  $this->setDescription(ilUtil::stripslashes($a_data["desc"]));
202  $this->setAllowRegister($a_data["allow_register"]);
203  $this->toggleAssignUsersStatus($a_data['assign_users']);
204  $this->setDiskQuota($a_data['disk_quota']);
205  $this->setPersonalWorkspaceDiskQuota($a_data['wsp_disk_quota']);
206  }
toggleAssignUsersStatus($a_assign_users)
setAllowRegister($a_allow_register)
set allow_register of role
setTitle($a_title)
set object title
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setPersonalWorkspaceDiskQuota($a_disk_quota)
Sets the minimal personal workspace disk quota imposed by this role.
setDescription($a_desc)
set object description
setDiskQuota($a_disk_quota)
Sets the minimal disk quota imposed by this role.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changeExistingObjects()

ilObjRole::changeExistingObjects (   $a_start_node,
  $a_mode,
  $a_filter,
  $a_exclusion_filter = array(),
  $a_operation_mode = self::MODE_READ_OPERATIONS,
  $a_operation_stack = [] 
)

Change existing objects.

Parameters
int$a_start_node
int$a_mode
arrayfilter Filter of object types (array('all') => change all objects
Returns

Definition at line 707 of file class.ilObjRole.php.

References $DIC, $nodes, ilObject\$rbacreview, ilObject\$tree, adjustPermissions(), deleteLocalPolicies(), and ilObject\getId().

708  {
709  global $DIC;
710 
711  $tree = $DIC->repositoryTree();
712  $rbacreview = $DIC->rbac()->review();
713 
714  // Get node info of subtree
715  $nodes = $tree->getRbacSubtreeInfo($a_start_node);
716 
717  // get local policies
718  $all_local_policies = $rbacreview->getObjectsWithStopedInheritance($this->getId());
719 
720  // filter relevant roles
721  $local_policies = array();
722  foreach ($all_local_policies as $lp) {
723  if (isset($nodes[$lp])) {
724  $local_policies[] = $lp;
725  }
726  }
727 
728  // Delete deprecated policies
729  switch ($a_mode) {
730  case self::MODE_UNPROTECTED_DELETE_LOCAL_POLICIES:
731  case self::MODE_PROTECTED_DELETE_LOCAL_POLICIES:
732  $local_policies = $this->deleteLocalPolicies($a_start_node, $local_policies, $a_filter);
733  #$local_policies = array($a_start_node == ROOT_FOLDER_ID ? SYSTEM_FOLDER_ID : $a_start_node);
734  break;
735  }
736  $this->adjustPermissions($a_mode, $nodes, $local_policies, $a_filter, $a_exclusion_filter, $a_operation_mode, $a_operation_stack);
737 
738 
739  #var_dump(memory_get_peak_usage());
740  #var_dump(memory_get_usage());
741  }
global $DIC
Definition: saml.php:7
deleteLocalPolicies($a_start, $a_policies, $a_filter)
Delete local policies.
getId()
get object id public
adjustPermissions($a_mode, $a_nodes, $a_policies, $a_filter, $a_exclusion_filter=array(), $a_operation_mode=self::MODE_READ_OPERATIONS, $a_operation_stack=[])
Adjust permissions.
+ Here is the call graph for this function:

◆ changeExistingObjectsGrantPermissions()

ilObjRole::changeExistingObjectsGrantPermissions (   $a_role_id,
  $a_permissions,
  $a_ref_id,
  $a_operation_mode 
)
protected
Parameters
$a_role_id
$a_permissions
$a_ref_id
$a_operation_mode

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

References $DIC.

Referenced by adjustPermissions().

928  {
929  global $DIC;
930 
931  $admin = $DIC->rbac()->admin();
932  $review = $DIC->rbac()->review();
933  if ($a_operation_mode == self::MODE_READ_OPERATIONS) {
934  $admin->grantPermission(
935  $a_role_id,
936  $a_permissions,
937  $a_ref_id
938  );
939  }
940  elseif ($a_operation_mode == self::MODE_ADD_OPERATIONS) {
941  $current_operations = $review->getRoleOperationsOnObject(
942  $a_role_id,
943  $a_ref_id
944  );
945  $this->logger->debug('Current operations');
946  $this->logger->dump($current_operations);
947 
948  $new_ops = array_unique(array_merge($a_permissions, $current_operations));
949  $this->logger->debug('New operations');
950  $this->logger->dump($new_ops);
951 
952  $admin->grantPermission(
953  $a_role_id,
954  $new_ops,
955  $a_ref_id
956  );
957  }
958  elseif ($a_operation_mode == self::MODE_REMOVE_OPERATIONS) {
959  $current_operations = $review->getRoleOperationsOnObject(
960  $a_role_id,
961  $a_ref_id
962  );
963  $this->logger->debug('Current operations');
964  $this->logger->dump($current_operations);
965 
966  $new_ops = array_diff($current_operations, $a_permissions);
967 
968  $admin->grantPermission(
969  $a_role_id,
970  $new_ops,
971  $a_ref_id
972  );
973  }
974  }
global $DIC
Definition: saml.php:7
+ Here is the caller graph for this function:

◆ create()

ilObjRole::create ( )

create

public

Returns
integer object id

Definition at line 240 of file class.ilObjRole.php.

References $DIC, ilObject\$id, $ilDB, $query, $res, getAllowRegister(), getAssignUsersStatus(), getDiskQuota(), and getPersonalWorkspaceDiskQuota().

241  {
242  global $DIC;
243 
244  $ilDB = $DIC['ilDB'];
245 
246  $this->id = parent::create();
247 
248  $query = "INSERT INTO role_data " .
249  "(role_id,allow_register,assign_users,disk_quota,wsp_disk_quota) " .
250  "VALUES " .
251  "(" . $ilDB->quote($this->id, 'integer') . "," .
252  $ilDB->quote($this->getAllowRegister(), 'integer') . "," .
253  $ilDB->quote($this->getAssignUsersStatus(), 'integer') . "," .
254  $ilDB->quote($this->getDiskQuota(), 'integer') . "," .
255  $ilDB->quote($this->getPersonalWorkspaceDiskQuota(), 'integer') . ")"
256  ;
257  $res = $ilDB->query($query);
258 
259  return $this->id;
260  }
getPersonalWorkspaceDiskQuota()
Gets the minimal personal workspace disk quota imposed by this role.
global $DIC
Definition: saml.php:7
getAllowRegister()
get allow_register
getDiskQuota()
Gets the minimal disk quota imposed by this role.
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ createDefaultRole()

static ilObjRole::createDefaultRole (   $a_title,
  $a_description,
  $a_tpl_name,
  $a_ref_id 
)
static
Parameters
type$a_title
type$a_description
type$a_tpl_name
type$a_ref_id
Returns
ilObjRole

Definition at line 72 of file class.ilObjRole.php.

References $DIC, $GLOBALS, $ilDB, $res, $row, ilObject\_lookupType(), and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilObjChatroom\createDefaultRole(), ilLearningSequenceRoles\initDefaultRoles(), ilObjSession\initDefaultRoles(), ilObjForum\initDefaultRoles(), ilObjBlog\initDefaultRoles(), ilObjGroup\initDefaultRoles(), ilObjCourse\initDefaultRoles(), and ilIndividualAssessmentAccessHandler\initDefaultRolesForObject().

73  {
74  global $DIC;
75 
76  $ilDB = $DIC['ilDB'];
77 
78  // SET PERMISSION TEMPLATE OF NEW LOCAL CONTRIBUTOR ROLE
79  $res = $ilDB->query("SELECT obj_id FROM object_data " .
80  " WHERE type=" . $ilDB->quote("rolt", "text") .
81  " AND title=" . $ilDB->quote($a_tpl_name, "text"));
82  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
83  $tpl_id = $row->obj_id;
84  }
85 
86  if (!$tpl_id) {
87  return null;
88  }
89 
90  include_once './Services/AccessControl/classes/class.ilObjRole.php';
91  $role = new ilObjRole();
92  $role->setTitle($a_title);
93  $role->setDescription($a_description);
94  $role->create();
95 
96  $GLOBALS['DIC']['rbacadmin']->assignRoleToFolder($role->getId(), $a_ref_id, 'y');
97 
98  $GLOBALS['DIC']['rbacadmin']->copyRoleTemplatePermissions(
99  $tpl_id,
100  ROLE_FOLDER_ID,
101  $a_ref_id,
102  $role->getId()
103  );
104 
105  $ops = $GLOBALS['DIC']['rbacreview']->getOperationsOfRole(
106  $role->getId(),
107  ilObject::_lookupType($a_ref_id, true),
108  $a_ref_id
109  );
110  $GLOBALS['DIC']['rbacadmin']->grantPermission(
111  $role->getId(),
112  $ops,
113  $a_ref_id
114  );
115  return $role;
116  }
Class ilObjRole.
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
static _lookupType($a_id, $a_reference=false)
lookup object type
$row
global $ilDB
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createPermissionIntersection()

ilObjRole::createPermissionIntersection (   $policy_stack,
  $a_current_ops,
  $a_id,
  $a_type 
)
protected

Create course group permission intersection.

Parameters
arrayoperation stack
int$a_id
string$a_type
Returns

Definition at line 1077 of file class.ilObjRole.php.

References $a_type, $DIC, $GLOBALS, $ilDB, $query, ilObject\$rbacadmin, ilObject\$rbacreview, $res, $row, $template_id, ilObject\$type, ilObject\_lookupObjId(), ilDBConstants\FETCHMODE_OBJECT, ilObject\getId(), GRP_TYPE_CLOSED, GRP_TYPE_OPEN, and ilObjGroup\lookupGroupTye().

Referenced by adjustPermissions().

1078  {
1079  global $DIC;
1080 
1081  $ilDB = $DIC['ilDB'];
1082  $rbacreview = $DIC['rbacreview'];
1083  $rbacadmin = $DIC['rbacadmin'];
1084 
1085  static $course_non_member_id = null;
1086  static $group_non_member_id = null;
1087  static $group_open_id = null;
1088  static $group_closed_id = null;
1089 
1090  // Get template id
1091  switch ($a_type) {
1092  case 'grp':
1093 
1094  include_once './Modules/Group/classes/class.ilObjGroup.php';
1096  #var_dump("GROUP TYPE",$type);
1097  switch ($type) {
1098  case GRP_TYPE_CLOSED:
1099  if (!$group_closed_id) {
1100  $query = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_grp_status_closed'";
1101  $res = $ilDB->query($query);
1102  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1103  $group_closed_id = $row->obj_id;
1104  }
1105  }
1106  $template_id = $group_closed_id;
1107  #var_dump("GROUP CLOSED id:" . $template_id);
1108  break;
1109 
1110  case GRP_TYPE_OPEN:
1111  default:
1112  if (!$group_open_id) {
1113  $query = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_grp_status_open'";
1114  $res = $ilDB->query($query);
1115  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1116  $group_open_id = $row->obj_id;
1117  }
1118  }
1119  $template_id = $group_open_id;
1120  #var_dump("GROUP OPEN id:" . $template_id);
1121  break;
1122  }
1123  break;
1124 
1125  case 'crs':
1126  if (!$course_non_member_id) {
1127  $query = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_crs_non_member'";
1128  $res = $ilDB->query($query);
1129  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1130  $course_non_member_id = $row->obj_id;
1131  }
1132  }
1133  $template_id = $course_non_member_id;
1134  break;
1135  }
1136 
1137  $current_ops = $a_current_ops[$a_type];
1138 
1139  // Create intersection template permissions
1140  if ($template_id) {
1141  //$rolf = $rbacreview->getRoleFolderIdOfObject($a_id);
1142 
1143  $rbacadmin->copyRolePermissionIntersection(
1144  $template_id,
1145  ROLE_FOLDER_ID,
1146  $this->getId(),
1147  end($policy_stack),
1148  $a_id,
1149  $this->getId()
1150  );
1151  } else {
1152  #echo "No template id for ".$a_id.' of type'.$a_type.'<br>';
1153  }
1154  #echo "ROLE ASSIGN: ".$rolf.' AID'.$a_id;
1155  if ($a_id and !$GLOBALS['DIC']['rbacreview']->isRoleAssignedToObject($this->getId(), $a_id)) {
1156  $rbacadmin->assignRoleToFolder($this->getId(), $a_id, "n");
1157  }
1158  return true;
1159  }
const GRP_TYPE_OPEN
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
getId()
get object id public
const GRP_TYPE_CLOSED
static _lookupObjId($a_id)
$query
$row
global $ilDB
static lookupGroupTye($a_id)
Lookup group type.
$template_id
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilObjRole::delete ( )

delete role and all related data

public

Returns
boolean true if all object data were removed; false if only a references were removed

Definition at line 424 of file class.ilObjRole.php.

References $DIC, $ilDB, $query, ilObject\$rbacadmin, ilObject\$rbacreview, $res, $users, ilLDAPRoleGroupMappingSettings\_deleteByRole(), ilObjUser\_lookupLogin(), ilObject\getId(), ilLoggerFactory\getLogger(), and getParent().

425  {
426  global $DIC;
427 
428  $rbacadmin = $DIC['rbacadmin'];
429  $rbacreview = $DIC['rbacreview'];
430  $ilDB = $DIC['ilDB'];
431 
432  // Temporary bugfix
433  if ($rbacreview->hasMultipleAssignments($this->getId())) {
434  ilLoggerFactory::getLogger('ac')->warning('Found role with multiple assignments: role_id: ' . $this->getId());
435  ilLoggerFactory::getLogger('ac')->warning('Aborted deletion of role.');
436  return false;
437  }
438 
439  if ($rbacreview->isAssignable($this->getId(), $this->getParent())) {
440  ilLoggerFactory::getLogger('ac')->debug('Handling assignable role...');
441  // do not delete a global role, if the role is the last
442  // role a user is assigned to.
443  //
444  // Performance improvement: In the code section below, we
445  // only need to consider _global_ roles. We don't need
446  // to check for _local_ roles, because a user who has
447  // a local role _always_ has a global role too.
448  $last_role_user_ids = array();
449  if ($this->getParent() == ROLE_FOLDER_ID) {
450  ilLoggerFactory::getLogger('ac')->debug('Handling global role...');
451  // The role is a global role: check if
452  // we find users who aren't assigned to any
453  // other global role than this one.
454  $user_ids = $rbacreview->assignedUsers($this->getId());
455 
456  foreach ($user_ids as $user_id) {
457  // get all roles each user has
458  $role_ids = $rbacreview->assignedRoles($user_id);
459 
460  // is last role?
461  if (count($role_ids) == 1) {
462  $last_role_user_ids[] = $user_id;
463  }
464  }
465  }
466 
467  // users with last role found?
468  if (count($last_role_user_ids) > 0) {
469  $user_names = array();
470  foreach ($last_role_user_ids as $user_id) {
471  // GET OBJECT TITLE
472  $user_names[] = ilObjUser::_lookupLogin($user_id);
473  }
474 
475  // TODO: This check must be done in rolefolder object because if multiple
476  // roles were selected the other roles are still deleted and the system does not
477  // give any feedback about this.
478  $users = implode(', ', $user_names);
479  ilLoggerFactory::getLogger('ac')->info('Cannot delete last global role of users.');
480  $this->ilias->raiseError($this->lng->txt("msg_user_last_role1") . " " .
481  $users . "<br/>" . $this->lng->txt("msg_user_last_role2"), $this->ilias->error_obj->WARNING);
482  } else {
483  ilLoggerFactory::getLogger('ac')->debug('Starting deletion of assignable role: role_id: ' . $this->getId());
484  $rbacadmin->deleteRole($this->getId(), $this->getParent());
485 
486  // Delete ldap role group mappings
487  include_once('./Services/LDAP/classes/class.ilLDAPRoleGroupMappingSettings.php');
489 
490  // delete object_data entry
491  parent::delete();
492 
493  // delete role_data entry
494  $query = "DELETE FROM role_data WHERE role_id = " . $ilDB->quote($this->getId(), 'integer');
495  $res = $ilDB->manipulate($query);
496 
497  include_once 'Services/AccessControl/classes/class.ilRoleDesktopItem.php';
498  $role_desk_item_obj = new ilRoleDesktopItem($this->getId());
499  $role_desk_item_obj->deleteAll();
500  }
501  } else {
502  ilLoggerFactory::getLogger('ac')->debug('Starting deletion of linked role: role_id ' . $this->getId());
503  // linked local role: INHERITANCE WAS STOPPED, SO DELETE ONLY THIS LOCAL ROLE
504  $rbacadmin->deleteLocalRole($this->getId(), $this->getParent());
505  }
506  return true;
507  }
static _lookupLogin($a_user_id)
lookup login
Class ilObjRoleGUI.
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
getId()
get object id public
redirection script todo: (a better solution should control the processing via a xml file) ...
$query
$users
Definition: authpage.php:44
getParent()
get reference id of parent object
global $ilDB
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

◆ deleteLocalPolicies()

ilObjRole::deleteLocalPolicies (   $a_start,
  $a_policies,
  $a_filter 
)
protected

Delete local policies.

Parameters
array$a_policiesarray of object ref ids that define local policies
Returns

Definition at line 748 of file class.ilObjRole.php.

References $DIC, ilObject\$rbacadmin, ilObject\$rbacreview, ilObject\_lookupObjId(), ilObject\_lookupType(), and ilObject\getId().

Referenced by changeExistingObjects().

749  {
750  global $DIC;
751 
752  $rbacreview = $DIC['rbacreview'];
753  $rbacadmin = $DIC['rbacadmin'];
754 
755  $local_policies = array();
756  foreach ($a_policies as $policy) {
757  if ($policy == $a_start or $policy == SYSTEM_FOLDER_ID) {
758  $local_policies[] = $policy;
759  continue;
760  }
761  if (!in_array('all', $a_filter) and !in_array(ilObject::_lookupType(ilObject::_lookupObjId($policy)), $a_filter)) {
762  $local_policies[] = $policy;
763  continue;
764  }
765  $rbacadmin->deleteLocalRole($this->getId(), $policy);
766  }
767  return $local_policies;
768  }
global $DIC
Definition: saml.php:7
getId()
get object id public
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllowRegister()

ilObjRole::getAllowRegister ( )

get allow_register

public

Returns
integer

Definition at line 283 of file class.ilObjRole.php.

Referenced by create(), and ilObjRoleGUI\readRoleProperties().

284  {
285  return $this->allow_register ? $this->allow_register : false;
286  }
+ Here is the caller graph for this function:

◆ getAssignUsersStatus()

ilObjRole::getAssignUsersStatus ( )

Definition at line 149 of file class.ilObjRole.php.

Referenced by create(), ilObjRoleGUI\readRoleProperties(), and update().

150  {
151  return $this->assign_users ? $this->assign_users : 0;
152  }
+ Here is the caller graph for this function:

◆ getCountMembers()

ilObjRole::getCountMembers ( )

Definition at line 509 of file class.ilObjRole.php.

References $DIC, and ilObject\$rbacreview.

510  {
511  global $DIC;
512 
513  $rbacreview = $DIC['rbacreview'];
514 
515  return count($rbacreview->assignedUsers($this->getId()));
516  }
global $DIC
Definition: saml.php:7

◆ getDiskQuota()

ilObjRole::getDiskQuota ( )

Gets the minimal disk quota imposed by this role.

Returns the minimal disk quota in bytes. The default value is 0.

public

Returns
integer

Definition at line 310 of file class.ilObjRole.php.

References $disk_quota.

Referenced by create(), ilObjRoleGUI\readRoleProperties(), and update().

311  {
312  return $this->disk_quota;
313  }
$disk_quota
The disk quota in bytes.
+ Here is the caller graph for this function:

◆ getParent()

ilObjRole::getParent ( )

get reference id of parent object

public

Returns
integer ref_id of parent object

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

References $parent.

Referenced by delete().

413  {
414  return $this->parent;
415  }
+ Here is the caller graph for this function:

◆ getPersonalWorkspaceDiskQuota()

ilObjRole::getPersonalWorkspaceDiskQuota ( )

Gets the minimal personal workspace disk quota imposed by this role.

Returns the minimal disk quota in bytes. The default value is 0.

public

Returns
integer

Definition at line 338 of file class.ilObjRole.php.

References $wsp_disk_quota.

Referenced by create(), ilObjRoleGUI\readRoleProperties(), and update().

339  {
340  return $this->wsp_disk_quota;
341  }
+ Here is the caller graph for this function:

◆ getPresentationTitle()

ilObjRole::getPresentationTitle ( )

return translated title for autogenerated roles

Returns

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

References _getTranslation(), and ilObject\getTitle().

141  {
142  return ilObjRole::_getTranslation($this->getTitle());
143  }
getTitle()
get object title public
static _getTranslation($a_role_title)
+ Here is the call graph for this function:

◆ isAutoGenerated()

static ilObjRole::isAutoGenerated (   $a_role_id)
static

Definition at line 695 of file class.ilObjRole.php.

References ilObject\_lookupTitle().

Referenced by ilObjRoleGUI\initFormRoleProperties().

696  {
697  return substr(ilObject::_lookupTitle($a_role_id), 0, 3) == 'il_';
698  }
static _lookupTitle($a_id)
lookup object title
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isHandledObjectType()

ilObjRole::isHandledObjectType (   $a_filter,
  $a_exclusion_filter,
  $a_type 
)
protected

Check if type is filterer.

Parameters
array$a_filter
string$a_type
Returns

Definition at line 983 of file class.ilObjRole.php.

References $a_type.

Referenced by adjustPermissions().

984  {
985  if (in_array($a_type, $a_exclusion_filter)) {
986  return false;
987  }
988 
989  if (in_array('all', $a_filter)) {
990  return true;
991  }
992  return in_array($a_type, $a_filter);
993  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ read()

ilObjRole::read ( )

loads "role" from database private

Definition at line 172 of file class.ilObjRole.php.

References $data, $DIC, $ilDB, $query, $res, and assignData().

Referenced by update().

173  {
174  global $DIC;
175 
176  $ilDB = $DIC['ilDB'];
177 
178  $query = "SELECT * FROM role_data WHERE role_id= " . $ilDB->quote($this->id, 'integer') . " ";
179 
180  $res = $ilDB->query($query);
181  if ($res->numRows() > 0) {
182  $data = $ilDB->fetchAssoc($res);
183 
184  // fill member vars in one shot
185  $this->assignData($data);
186  } else {
187  $this->ilias->raiseError("<b>Error: There is no dataset with id " . $this->id . "!</b><br />class: " . get_class($this) . "<br />Script: " . __FILE__ . "<br />Line: " . __LINE__, $this->ilias->FATAL);
188  }
189 
190  parent::read();
191  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
redirection script todo: (a better solution should control the processing via a xml file) ...
$query
global $ilDB
assignData($a_data)
loads a record "role" from array public
$data
Definition: bench.php:6
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAllowRegister()

ilObjRole::setAllowRegister (   $a_allow_register)

set allow_register of role

public

Parameters
integer

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

Referenced by assignData(), and ilObjRoleGUI\loadRoleProperties().

269  {
270  if (empty($a_allow_register)) {
271  $a_allow_register == 0;
272  }
273 
274  $this->allow_register = (int) $a_allow_register;
275  }
+ Here is the caller graph for this function:

◆ setDiskQuota()

ilObjRole::setDiskQuota (   $a_disk_quota)

Sets the minimal disk quota imposed by this role.

The minimal disk quota is specified in bytes.

public

Parameters
integer

Definition at line 296 of file class.ilObjRole.php.

Referenced by assignData(), and ilObjRoleGUI\loadRoleProperties().

297  {
298  $this->disk_quota = $a_disk_quota;
299  }
+ Here is the caller graph for this function:

◆ setParent()

ilObjRole::setParent (   $a_parent_ref)

set reference id of parent object this is neccessary for non RBAC protected objects!!!

public

Parameters
integerref_id of parent object

Definition at line 401 of file class.ilObjRole.php.

402  {
403  $this->parent = $a_parent_ref;
404  }

◆ setPersonalWorkspaceDiskQuota()

ilObjRole::setPersonalWorkspaceDiskQuota (   $a_disk_quota)

Sets the minimal personal workspace disk quota imposed by this role.

The minimal disk quota is specified in bytes.

public

Parameters
integer

Definition at line 324 of file class.ilObjRole.php.

Referenced by assignData(), and ilObjRoleGUI\loadRoleProperties().

325  {
326  $this->wsp_disk_quota = $a_disk_quota;
327  }
+ Here is the caller graph for this function:

◆ toggleAssignUsersStatus()

ilObjRole::toggleAssignUsersStatus (   $a_assign_users)

Definition at line 145 of file class.ilObjRole.php.

Referenced by assignData(), and ilObjRoleGUI\loadRoleProperties().

146  {
147  $this->assign_users = (int) $a_assign_users;
148  }
+ Here is the caller graph for this function:

◆ update()

ilObjRole::update ( )

updates a record "role" and write it into database public

Definition at line 212 of file class.ilObjRole.php.

References $DIC, $ilDB, $query, $res, getAssignUsersStatus(), getDiskQuota(), getPersonalWorkspaceDiskQuota(), read(), and League\Flysystem\Adapter\Polyfill\update().

213  {
214  global $DIC;
215 
216  $ilDB = $DIC['ilDB'];
217 
218  $query = "UPDATE role_data SET " .
219  "allow_register= " . $ilDB->quote($this->allow_register, 'integer') . ", " .
220  "assign_users = " . $ilDB->quote($this->getAssignUsersStatus(), 'integer') . ", " .
221  "disk_quota = " . $ilDB->quote($this->getDiskQuota(), 'integer') . ", " .
222  "wsp_disk_quota = " . $ilDB->quote($this->getPersonalWorkspaceDiskQuota(), 'integer') . " " .
223  "WHERE role_id= " . $ilDB->quote($this->id, 'integer') . " ";
224  $res = $ilDB->manipulate($query);
225 
226  parent::update();
227 
228  $this->read();
229 
230  return true;
231  }
getPersonalWorkspaceDiskQuota()
Gets the minimal personal workspace disk quota imposed by this role.
global $DIC
Definition: saml.php:7
getDiskQuota()
Gets the minimal disk quota imposed by this role.
foreach($_POST as $key=> $value) $res
$query
update($pash, $contents, Config $config)
global $ilDB
read()
loads "role" from database private
+ Here is the call graph for this function:

◆ updateOperationStack()

ilObjRole::updateOperationStack ( $a_stack,
  $a_node,
  $a_init = false 
)
protected

Update operation stack.

Parameters
array$a_stack
int$a_node
Returns

Definition at line 1001 of file class.ilObjRole.php.

References $DIC, ilObject\$rbacreview, and ilObject\getId().

Referenced by adjustPermissions().

1002  {
1003  global $DIC;
1004 
1005  $rbacreview = $DIC['rbacreview'];
1006 
1007  $has_policies = null;
1008  $policy_origin = null;
1009 
1010  if ($a_node == ROOT_FOLDER_ID) {
1011  $has_policies = true;
1012  $policy_origin = ROLE_FOLDER_ID;
1013  } else {
1014  $has_policies = $rbacreview->getLocalPolicies($a_node);
1015  $policy_origin = $a_node;
1016 
1017  if ($a_init) {
1018  $parent_roles = $rbacreview->getParentRoleIds($a_node, false);
1019  if ($parent_roles[$this->getId()]) {
1020  $a_stack[] = $rbacreview->getAllOperationsOfRole(
1021  $this->getId(),
1022  $parent_roles[$this->getId()]['parent']
1023  );
1024  }
1025  return true;
1026  }
1027  }
1028 
1029  if (!$has_policies) {
1030  return false;
1031  }
1032 
1033  $a_stack[] = $rbacreview->getAllOperationsOfRole(
1034  $this->getId(),
1035  $policy_origin
1036  );
1037  return true;
1038  }
global $DIC
Definition: saml.php:7
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updatePolicyStack()

ilObjRole::updatePolicyStack ( $a_stack,
  $a_node 
)
protected

Update policy stack.

Parameters
object$a_node
Returns

Definition at line 1045 of file class.ilObjRole.php.

References $DIC, and ilObject\$rbacreview.

Referenced by adjustPermissions().

1046  {
1047  global $DIC;
1048 
1049  $rbacreview = $DIC['rbacreview'];
1050 
1051  $has_policies = null;
1052  $policy_origin = null;
1053 
1054  if ($a_node == ROOT_FOLDER_ID) {
1055  $has_policies = true;
1056  $policy_origin = ROLE_FOLDER_ID;
1057  } else {
1058  $has_policies = $rbacreview->getLocalPolicies($a_node);
1059  $policy_origin = $a_node;
1060  }
1061 
1062  if (!$has_policies) {
1063  return false;
1064  }
1065 
1066  $a_stack[] = $policy_origin;
1067  return true;
1068  }
global $DIC
Definition: saml.php:7
+ Here is the caller graph for this function:

◆ validate()

ilObjRole::validate ( )

Validate role data.

Returns
bool

Definition at line 123 of file class.ilObjRole.php.

References $DIC, $ilErr, and ilObject\getTitle().

124  {
125  global $DIC;
126 
127  $ilErr = $DIC['ilErr'];
128 
129  if (substr($this->getTitle(), 0, 3) == 'il_') {
130  $ilErr->setMessage('msg_role_reserved_prefix');
131  return false;
132  }
133  return true;
134  }
global $DIC
Definition: saml.php:7
$ilErr
Definition: raiseError.php:18
getTitle()
get object title public
+ Here is the call graph for this function:

Field Documentation

◆ $allow_register

ilObjRole::$allow_register

Definition at line 41 of file class.ilObjRole.php.

◆ $assign_users

ilObjRole::$assign_users

Definition at line 42 of file class.ilObjRole.php.

◆ $disk_quota

ilObjRole::$disk_quota

The disk quota in bytes.

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

Referenced by getDiskQuota().

◆ $logger

ilObjRole::$logger = null
private

Definition at line 30 of file class.ilObjRole.php.

◆ $parent

ilObjRole::$parent

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

Referenced by getParent().

◆ $wsp_disk_quota

ilObjRole::$wsp_disk_quota

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

Referenced by getPersonalWorkspaceDiskQuota().

◆ MODE_ADD_OPERATIONS

const ilObjRole::MODE_ADD_OPERATIONS = 1

Definition at line 23 of file class.ilObjRole.php.

Referenced by ilObjRoleFolderGUI\adjustRoleObject().

◆ MODE_PROTECTED_DELETE_LOCAL_POLICIES

◆ MODE_PROTECTED_KEEP_LOCAL_POLICIES

◆ MODE_READ_OPERATIONS

const ilObjRole::MODE_READ_OPERATIONS = 2

◆ MODE_REMOVE_OPERATIONS

const ilObjRole::MODE_REMOVE_OPERATIONS = 3

Definition at line 25 of file class.ilObjRole.php.

Referenced by ilObjRoleFolderGUI\adjustRoleObject().

◆ MODE_UNPROTECTED_DELETE_LOCAL_POLICIES

◆ MODE_UNPROTECTED_KEEP_LOCAL_POLICIES


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