ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 @access 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 @access private More...
 
 assignData ($a_data)
 loads a record "role" from array @access public More...
 
 update ()
 updates a record "role" and write it into database @access 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())
 Change existing objects. More...
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor @access 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 @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access 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...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access 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) @access 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 _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 @global type $ilDB. 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@access public 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 _getIcon ( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. 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
 
 $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())
 Adjust permissions. More...
 
 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...
 

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 @access public.

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

Reimplemented from ilObject.

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

45 {
46 $this->type = "role";
47 $this->disk_quota = 0;
48 $this->wsp_disk_quota = 0;
49 parent::__construct($a_id, $a_call_by_reference);
50 }

Member Function Documentation

◆ __getPermissionDefinitions()

ilObjRole::__getPermissionDefinitions ( )

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

573 {
575
576 $operation_info = $rbacreview->getOperationAssignment();
577 foreach ($operation_info as $info) {
578 if ($objDefinition->getDevMode($info['type'])) {
579 continue;
580 }
581 $rbac_objects[$info['typ_id']] = array("obj_id" => $info['typ_id'],
582 "type" => $info['type']);
583
584 // handle plugin permission texts
585 $txt = $objDefinition->isPlugin($info['type'])
586 ? ilObjectPlugin::lookupTxtById($info['type'], $info['type'] . "_" . $info['operation'])
587 : $lng->txt($info['type'] . "_" . $info['operation']);
588 if (substr($info['operation'], 0, 7) == "create_" &&
589 $objDefinition->isPlugin(substr($info['operation'], 7))) {
590 $txt = ilObjectPlugin::lookupTxtById(substr($info['operation'], 7), $info['type'] . "_" . $info['operation']);
591 }
592 $rbac_operations[$info['typ_id']][$info['ops_id']] = array(
593 "ops_id" => $info['ops_id'],
594 "title" => $info['operation'],
595 "name" => $txt);
596 }
597 return array($rbac_objects,$rbac_operations);
598 }
static lookupTxtById($plugin_id, $lang_var)
$txt
Definition: error.php:11
$info
Definition: index.php:5
global $ilDB

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

+ Here is the call graph for this function:

◆ _getAssignUsersStatus()

static ilObjRole::_getAssignUsersStatus (   $a_role_id)
static

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

139 {
140 global $ilDB;
141
142 $query = "SELECT assign_users FROM role_data WHERE role_id = " . $ilDB->quote($a_role_id, 'integer') . " ";
143 $res = $ilDB->query($query);
144 while ($row = $ilDB->fetchObject($res)) {
145 return $row->assign_users ? true : false;
146 }
147 return false;
148 }
$query
foreach($_POST as $key=> $value) $res

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

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

+ Here is the caller graph for this function:

◆ _getAuthMode()

static ilObjRole::_getAuthMode (   $a_role_id)
static

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

522 {
523 global $ilDB;
524
525 $query = "SELECT auth_mode FROM role_data " .
526 "WHERE role_id= " . $ilDB->quote($a_role_id, 'integer') . " ";
527 $res = $ilDB->query($query);
528 $row = $ilDB->fetchAssoc($res);
529
530 return $row['auth_mode'];
531 }

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

◆ _getRolesByAuthMode()

static ilObjRole::_getRolesByAuthMode (   $a_auth_mode)
static

Get roles by auth mode.

@access public

Parameters
stringauth mode

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

541 {
542 global $ilDB;
543
544 $query = "SELECT * FROM role_data " .
545 "WHERE auth_mode = " . $ilDB->quote($a_auth_mode, 'text');
546 $res = $ilDB->query($query);
547 $roles = array();
548 while ($row = $ilDB->fetchObject($res)) {
549 $roles[] = $row->role_id;
550 }
551 return $roles;
552 }

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

Referenced by ilRadiusSettings\read().

+ Here is the caller graph for this function:

◆ _getTranslation()

◆ _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 350 of file class.ilObjRole.php.

351 {
352 global $ilDB;
353
354 $query = "SELECT * FROM role_data " .
355 " WHERE role_id =" . $ilDB->quote($a_role_id, 'integer');
356
357 $res = $ilDB->query($query);
358 if ($role_rec = $ilDB->fetchAssoc($res)) {
359 if ($role_rec["allow_register"]) {
360 return true;
361 }
362 }
363 return false;
364 }

References $ilDB, $query, and $res.

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

+ Here is the caller graph for this function:

◆ _lookupRegisterAllowed()

static ilObjRole::_lookupRegisterAllowed ( )
static

get all roles that are activated in user registration

@access public

Returns
array array of int: role ids

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

326 {
327 global $ilDB;
328
329 $query = "SELECT * FROM role_data " .
330 "JOIN object_data ON object_data.obj_id = role_data.role_id " .
331 "WHERE allow_register = 1";
332 $res = $ilDB->query($query);
333
334 $roles = array();
335 while ($role = $ilDB->fetchAssoc($res)) {
336 $roles[] = array("id" => $role["obj_id"],
337 "title" => $role["title"],
338 "auth_mode" => $role['auth_mode']);
339 }
340
341 return $roles;
342 }

References $ilDB, $query, and $res.

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

+ Here is the caller graph for this function:

◆ _removeObjectId()

static ilObjRole::_removeObjectId (   $a_role_title)
static

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

498 {
499 $role_title_parts = explode('_', $a_role_title);
500
501 $test2 = (int) $role_title_parts[3];
502 if ($test2 > 0) {
503 unset($role_title_parts[3]);
504 }
505
506 return implode('_', $role_title_parts);
507 }

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

+ Here is the caller graph for this function:

◆ _resetAuthMode()

static ilObjRole::_resetAuthMode (   $a_auth_mode)
static

Reset auth mode to default.

@access public

Parameters
stringauth mode

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

563 {
564 global $ilDB;
565
566 $query = "UPDATE role_data SET auth_mode = 'default' WHERE auth_mode = " . $ilDB->quote($a_auth_mode, 'text');
567 $res = $ilDB->manipulate($query);
568 }

References $ilDB, $query, and $res.

Referenced by ilRadiusSettings\save().

+ Here is the caller graph for this function:

◆ _updateAuthMode()

static ilObjRole::_updateAuthMode (   $a_roles)
static

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

510 {
511 global $ilDB;
512
513 foreach ($a_roles as $role_id => $auth_mode) {
514 $query = "UPDATE role_data SET " .
515 "auth_mode= " . $ilDB->quote($auth_mode, 'text') . " " .
516 "WHERE role_id= " . $ilDB->quote($role_id, 'integer') . " ";
517 $res = $ilDB->manipulate($query);
518 }
519 }

References $ilDB, $query, and $res.

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

+ Here is the caller graph for this function:

◆ adjustPermissions()

ilObjRole::adjustPermissions (   $a_mode,
  $a_nodes,
  $a_policies,
  $a_filter,
  $a_exclusion_filter = array() 
)
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 677 of file class.ilObjRole.php.

678 {
680
681 $operation_stack = array();
682 $policy_stack = array();
683 $node_stack = array();
684
685 $start_node = current($a_nodes);
686 array_push($node_stack, $start_node);
687 $this->updatePolicyStack($policy_stack, $start_node['child']);
688 $this->updateOperationStack($operation_stack, $start_node['child'], true);
689
690 include_once "Services/AccessControl/classes/class.ilRbacLog.php";
691 $rbac_log_active = ilRbacLog::isActive();
692
693 $local_policy = false;
694 foreach ($a_nodes as $node) {
695 $cmp_node = end($node_stack);
696 while ($relation = $tree->getRelationOfNodes($node, $cmp_node)) {
697 switch ($relation) {
700 $GLOBALS['ilLog']->write(__METHOD__ . ': Handling sibling/none relation.');
701 array_pop($operation_stack);
702 array_pop($policy_stack);
703 array_pop($node_stack);
704 $cmp_node = end($node_stack);
705 $local_policy = false;
706 break;
707
711 default:
712 $GLOBALS['ilLog']->write(__METHOD__ . ': Handling child/equals/parent ' . $relation);
713 break 2;
714 }
715 }
716
717 if ($local_policy) {
718 continue;
719 }
720
721 // Start node => set permissions and continue
722 if ($node['child'] == $start_node['child']) {
723 if ($this->isHandledObjectType($a_filter, $a_exclusion_filter, $node['type'])) {
724 if ($rbac_log_active) {
725 $rbac_log_roles = $rbacreview->getParentRoleIds($node['child'], false);
726 $rbac_log_old = ilRbacLog::gatherFaPa($node['child'], array_keys($rbac_log_roles));
727 }
728
729 // Set permissions
730 $perms = end($operation_stack);
731 $rbacadmin->grantPermission(
732 $this->getId(),
733 (array) $perms[$node['type']],
734 $node['child']
735 );
736
737 if ($rbac_log_active) {
738 $rbac_log_new = ilRbacLog::gatherFaPa($node['child'], array_keys($rbac_log_roles));
739 $rbac_log = ilRbacLog::diffFaPa($rbac_log_old, $rbac_log_new);
740 ilRbacLog::add(ilRbacLog::EDIT_TEMPLATE_EXISTING, $node['child'], $rbac_log);
741 }
742 }
743 continue;
744 }
745
746 // Node has local policies => update permission stack and continue
747 if (in_array($node['child'], $a_policies) and ($node['child'] != SYSTEM_FOLDER_ID)) {
748 $local_policy = true;
749 $this->updatePolicyStack($policy_stack, $node['child']);
750 $this->updateOperationStack($operation_stack, $node['child']);
751 array_push($node_stack, $node);
752 continue;
753 }
754
755 // Continue if this object type is not in filter
756 if (!$this->isHandledObjectType($a_filter, $a_exclusion_filter, $node['type'])) {
757 continue;
758 }
759
760 if ($rbac_log_active) {
761 $rbac_log_roles = $rbacreview->getParentRoleIds($node['child'], false);
762 $rbac_log_old = ilRbacLog::gatherFaPa($node['child'], array_keys($rbac_log_roles));
763 }
764
765 // Node is course => create course permission intersection
766 if (($a_mode == self::MODE_UNPROTECTED_DELETE_LOCAL_POLICIES or
767 $a_mode == self::MODE_UNPROTECTED_KEEP_LOCAL_POLICIES) and ($node['type'] == 'crs')) {
768 // Copy role permission intersection
769 $perms = end($operation_stack);
770 $this->createPermissionIntersection($policy_stack, $perms['crs'], $node['child'], $node['type']);
771 if ($this->updateOperationStack($operation_stack, $node['child'])) {
772 $this->updatePolicyStack($policy_stack, $node['child']);
773 array_push($node_stack, $node);
774 }
775 }
776
777 // Node is group => create group permission intersection
778 if (($a_mode == self::MODE_UNPROTECTED_DELETE_LOCAL_POLICIES or
779 $a_mode == self::MODE_UNPROTECTED_KEEP_LOCAL_POLICIES) and ($node['type'] == 'grp')) {
780 // Copy role permission intersection
781 $perms = end($operation_stack);
782 $this->createPermissionIntersection($policy_stack, $perms['grp'], $node['child'], $node['type']);
783 if ($this->updateOperationStack($operation_stack, $node['child'])) {
784 $this->updatePolicyStack($policy_stack, $node['child']);
785 array_push($node_stack, $node);
786 }
787 }
788
789 // Set permission
790 $perms = end($operation_stack);
791 $rbacadmin->grantPermission(
792 $this->getId(),
793 (array) $perms[$node['type']],
794 $node['child']
795 );
796
797 if ($rbac_log_active) {
798 $rbac_log_new = ilRbacLog::gatherFaPa($node['child'], array_keys($rbac_log_roles));
799 $rbac_log = ilRbacLog::diffFaPa($rbac_log_old, $rbac_log_new);
800 ilRbacLog::add(ilRbacLog::EDIT_TEMPLATE_EXISTING, $node['child'], $rbac_log);
801 }
802 }
803 }
createPermissionIntersection($policy_stack, $a_current_ops, $a_id, $a_type)
Create course group permission intersection.
updatePolicyStack(&$a_stack, $a_node)
Update policy stack.
isHandledObjectType($a_filter, $a_exclusion_filter, $a_type)
Check if type is filterer.
updateOperationStack(&$a_stack, $a_node, $a_init=false)
Update operation stack.
getId()
get object id @access public
static diffFaPa(array $a_old, array $a_new)
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
const EDIT_TEMPLATE_EXISTING
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
static isActive()
const RELATION_EQUALS
const RELATION_PARENT
const RELATION_NONE
const RELATION_SIBLING
const RELATION_CHILD
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

References $GLOBALS, ilObject\$rbacadmin, ilObject\$rbacreview, ilObject\$tree, ilRbacLog\add(), 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().

+ 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 @access public

Parameters
arrayroledata

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

179 {
180 $this->setTitle(ilUtil::stripSlashes($a_data["title"]));
181 $this->setDescription(ilUtil::stripslashes($a_data["desc"]));
182 $this->setAllowRegister($a_data["allow_register"]);
183 $this->toggleAssignUsersStatus($a_data['assign_users']);
184 $this->setDiskQuota($a_data['disk_quota']);
185 $this->setPersonalWorkspaceDiskQuota($a_data['wsp_disk_quota']);
186 }
setAllowRegister($a_allow_register)
set allow_register of role
toggleAssignUsersStatus($a_assign_users)
setDiskQuota($a_disk_quota)
Sets the minimal disk quota imposed by this role.
setPersonalWorkspaceDiskQuota($a_disk_quota)
Sets the minimal personal workspace disk quota imposed by this role.
setTitle($a_title)
set object title
setDescription($a_desc)
set object description
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

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

Referenced by read().

+ 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() 
)

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 613 of file class.ilObjRole.php.

614 {
615 global $tree,$rbacreview;
616
617 // Get node info of subtree
618 $nodes = $tree->getRbacSubtreeInfo($a_start_node);
619
620 // get local policies
621 $all_local_policies = $rbacreview->getObjectsWithStopedInheritance($this->getId());
622
623 // filter relevant roles
624 $local_policies = array();
625 foreach ($all_local_policies as $lp) {
626 if (isset($nodes[$lp])) {
627 $local_policies[] = $lp;
628 }
629 }
630
631 // Delete deprecated policies
632 switch ($a_mode) {
635 $local_policies = $this->deleteLocalPolicies($a_start_node, $local_policies, $a_filter);
636 #$local_policies = array($a_start_node == ROOT_FOLDER_ID ? SYSTEM_FOLDER_ID : $a_start_node);
637 break;
638 }
639 $this->adjustPermissions($a_mode, $nodes, $local_policies, $a_filter, $a_exclusion_filter);
640
641 #var_dump(memory_get_peak_usage());
642 #var_dump(memory_get_usage());
643 }
const MODE_PROTECTED_DELETE_LOCAL_POLICIES
const MODE_UNPROTECTED_DELETE_LOCAL_POLICIES
deleteLocalPolicies($a_start, $a_policies, $a_filter)
Delete local policies.
adjustPermissions($a_mode, $a_nodes, $a_policies, $a_filter, $a_exclusion_filter=array())
Adjust permissions.

References ilObject\$rbacreview, ilObject\$tree, adjustPermissions(), deleteLocalPolicies(), ilObject\getId(), MODE_PROTECTED_DELETE_LOCAL_POLICIES, and MODE_UNPROTECTED_DELETE_LOCAL_POLICIES.

+ Here is the call graph for this function:

◆ create()

ilObjRole::create ( )

create

@access public

Returns
integer object id

Reimplemented from ilObject.

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

219 {
220 global $ilDB;
221
222 $this->id = parent::create();
223
224 $query = "INSERT INTO role_data " .
225 "(role_id,allow_register,assign_users,disk_quota,wsp_disk_quota) " .
226 "VALUES " .
227 "(" . $ilDB->quote($this->id, 'integer') . "," .
228 $ilDB->quote($this->getAllowRegister(), 'integer') . "," .
229 $ilDB->quote($this->getAssignUsersStatus(), 'integer') . "," .
230 $ilDB->quote($this->getDiskQuota(), 'integer') . "," .
231 $ilDB->quote($this->getPersonalWorkspaceDiskQuota(), 'integer') . ")"
232 ;
233 $res = $ilDB->query($query);
234
235 return $this->id;
236 }
getPersonalWorkspaceDiskQuota()
Gets the minimal personal workspace disk quota imposed by this role.
getAllowRegister()
get allow_register
getDiskQuota()
Gets the minimal disk quota imposed by this role.

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

+ 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 60 of file class.ilObjRole.php.

61 {
62 global $ilDB;
63
64 // SET PERMISSION TEMPLATE OF NEW LOCAL CONTRIBUTOR ROLE
65 $res = $ilDB->query("SELECT obj_id FROM object_data " .
66 " WHERE type=" . $ilDB->quote("rolt", "text") .
67 " AND title=" . $ilDB->quote($a_tpl_name, "text"));
68 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
69 $tpl_id = $row->obj_id;
70 }
71
72 if (!$tpl_id) {
73 return null;
74 }
75
76 include_once './Services/AccessControl/classes/class.ilObjRole.php';
77 $role = new ilObjRole();
78 $role->setTitle($a_title);
79 $role->setDescription($a_description);
80 $role->create();
81
82 $GLOBALS['rbacadmin']->assignRoleToFolder($role->getId(), $a_ref_id, 'y');
83
84 $GLOBALS['rbacadmin']->copyRoleTemplatePermissions(
85 $tpl_id,
86 ROLE_FOLDER_ID,
87 $a_ref_id,
88 $role->getId()
89 );
90
91 $ops = $GLOBALS['rbacreview']->getOperationsOfRole(
92 $role->getId(),
93 ilObject::_lookupType($a_ref_id, true),
94 $a_ref_id
95 );
96 $GLOBALS['rbacadmin']->grantPermission(
97 $role->getId(),
98 $ops,
99 $a_ref_id
100 );
101 return $role;
102 }
Class ilObjRole.
static _lookupType($a_id, $a_reference=false)
lookup object type

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

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

+ 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 901 of file class.ilObjRole.php.

902 {
904
905 static $course_non_member_id = null;
906 static $group_non_member_id = null;
907 static $group_open_id = null;
908 static $group_closed_id = null;
909
910 // Get template id
911 switch ($a_type) {
912 case 'grp':
913
914 include_once './Modules/Group/classes/class.ilObjGroup.php';
916 #var_dump("GROUP TYPE",$type);
917 switch ($type) {
918 case GRP_TYPE_CLOSED:
919 if (!$group_closed_id) {
920 $query = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_grp_status_closed'";
921 $res = $ilDB->query($query);
922 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
923 $group_closed_id = $row->obj_id;
924 }
925 }
926 $template_id = $group_closed_id;
927 #var_dump("GROUP CLOSED id:" . $template_id);
928 break;
929
930 case GRP_TYPE_OPEN:
931 default:
932 if (!$group_open_id) {
933 $query = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_grp_status_open'";
934 $res = $ilDB->query($query);
935 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
936 $group_open_id = $row->obj_id;
937 }
938 }
939 $template_id = $group_open_id;
940 #var_dump("GROUP OPEN id:" . $template_id);
941 break;
942 }
943 break;
944
945 case 'crs':
946 if (!$course_non_member_id) {
947 $query = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_crs_non_member'";
948 $res = $ilDB->query($query);
949 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
950 $course_non_member_id = $row->obj_id;
951 }
952 }
953 $template_id = $course_non_member_id;
954 break;
955 }
956
957 $current_ops = $a_current_ops[$a_type];
958
959 // Create intersection template permissions
960 if ($template_id) {
961 //$rolf = $rbacreview->getRoleFolderIdOfObject($a_id);
962
963 $rbacadmin->copyRolePermissionIntersection(
965 ROLE_FOLDER_ID,
966 $this->getId(),
967 end($policy_stack),
968 $a_id,
969 $this->getId()
970 );
971 } else {
972 #echo "No template id for ".$a_id.' of type'.$a_type.'<br>';
973 }
974 #echo "ROLE ASSIGN: ".$rolf.' AID'.$a_id;
975 if ($a_id and !$GLOBALS['rbacreview']->isRoleAssignedToObject($this->getId(), $a_id)) {
976 $rbacadmin->assignRoleToFolder($this->getId(), $a_id, "n");
977 }
978 return true;
979 }
const GRP_TYPE_OPEN
const GRP_TYPE_CLOSED
static lookupGroupTye($a_id)
Lookup group type.
static _lookupObjId($a_id)
$a_type
Definition: workflow.php:92
$template_id

References $a_type, $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().

+ 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

@access public

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

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

397 {
399
400 // Temporary bugfix
401 if ($rbacreview->hasMultipleAssignments($this->getId())) {
402 ilLoggerFactory::getLogger('ac')->warning('Found role with multiple assignments: role_id: ' . $this->getId());
403 ilLoggerFactory::getLogger('ac')->warning('Aborted deletion of role.');
404 return false;
405 }
406
407 if ($rbacreview->isAssignable($this->getId(), $this->getParent())) {
408 ilLoggerFactory::getLogger('ac')->debug('Handling assignable role...');
409 // do not delete a global role, if the role is the last
410 // role a user is assigned to.
411 //
412 // Performance improvement: In the code section below, we
413 // only need to consider _global_ roles. We don't need
414 // to check for _local_ roles, because a user who has
415 // a local role _always_ has a global role too.
416 $last_role_user_ids = array();
417 if ($this->getParent() == ROLE_FOLDER_ID) {
418 ilLoggerFactory::getLogger('ac')->debug('Handling global role...');
419 // The role is a global role: check if
420 // we find users who aren't assigned to any
421 // other global role than this one.
422 $user_ids = $rbacreview->assignedUsers($this->getId());
423
424 foreach ($user_ids as $user_id) {
425 // get all roles each user has
426 $role_ids = $rbacreview->assignedRoles($user_id);
427
428 // is last role?
429 if (count($role_ids) == 1) {
430 $last_role_user_ids[] = $user_id;
431 }
432 }
433 }
434
435 // users with last role found?
436 if (count($last_role_user_ids) > 0) {
437 $user_names = array();
438 foreach ($last_role_user_ids as $user_id) {
439 // GET OBJECT TITLE
440 $user_names[] = ilObjUser::_lookupLogin($user_id);
441 }
442
443 // TODO: This check must be done in rolefolder object because if multiple
444 // roles were selected the other roles are still deleted and the system does not
445 // give any feedback about this.
446 $users = implode(', ', $user_names);
447 ilLoggerFactory::getLogger('ac')->info('Cannot delete last global role of users.');
448 $this->ilias->raiseError($this->lng->txt("msg_user_last_role1") . " " .
449 $users . "<br/>" . $this->lng->txt("msg_user_last_role2"), $this->ilias->error_obj->WARNING);
450 } else {
451 ilLoggerFactory::getLogger('ac')->debug('Starting deletion of assignable role: role_id: ' . $this->getId());
452 $rbacadmin->deleteRole($this->getId(), $this->getParent());
453
454 // Delete ldap role group mappings
455 include_once('./Services/LDAP/classes/class.ilLDAPRoleGroupMappingSettings.php');
457
458 // delete object_data entry
459 parent::delete();
460
461 // delete role_data entry
462 $query = "DELETE FROM role_data WHERE role_id = " . $ilDB->quote($this->getId(), 'integer');
463 $res = $ilDB->manipulate($query);
464
465 include_once 'Services/AccessControl/classes/class.ilRoleDesktopItem.php';
466 $role_desk_item_obj = new ilRoleDesktopItem($this->getId());
467 $role_desk_item_obj->deleteAll();
468 }
469 } else {
470 ilLoggerFactory::getLogger('ac')->debug('Starting deletion of linked role: role_id ' . $this->getId());
471 // linked local role: INHERITANCE WAS STOPPED, SO DELETE ONLY THIS LOCAL ROLE
472 $rbacadmin->deleteLocalRole($this->getId(), $this->getParent());
473 }
474 return true;
475 }
$users
Definition: authpage.php:44
static getLogger($a_component_id)
Get component logger.
getParent()
get reference id of parent object
static _lookupLogin($a_user_id)
lookup login
redirection script todo: (a better solution should control the processing via a xml file)

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

+ 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 650 of file class.ilObjRole.php.

651 {
652 global $rbacreview,$rbacadmin;
653
654 $local_policies = array();
655 foreach ($a_policies as $policy) {
656 if ($policy == $a_start or $policy == SYSTEM_FOLDER_ID) {
657 $local_policies[] = $policy;
658 continue;
659 }
660 if (!in_array('all', $a_filter) and !in_array(ilObject::_lookupType(ilObject::_lookupObjId($policy)), $a_filter)) {
661 $local_policies[] = $policy;
662 continue;
663 }
664 $rbacadmin->deleteLocalRole($this->getId(), $policy);
665 }
666 return $local_policies;
667 }

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

Referenced by changeExistingObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllowRegister()

ilObjRole::getAllowRegister ( )

get allow_register

@access public

Returns
integer

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

260 {
261 return $this->allow_register ? $this->allow_register : false;
262 }

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

+ Here is the caller graph for this function:

◆ getAssignUsersStatus()

ilObjRole::getAssignUsersStatus ( )

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

134 {
135 return $this->assign_users ? $this->assign_users : 0;
136 }

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

+ Here is the caller graph for this function:

◆ getCountMembers()

ilObjRole::getCountMembers ( )

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

478 {
479 global $rbacreview;
480
481 return count($rbacreview->assignedUsers($this->getId()));
482 }

References ilObject\$rbacreview.

◆ getDiskQuota()

ilObjRole::getDiskQuota ( )

Gets the minimal disk quota imposed by this role.

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

@access public

Returns
integer

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

287 {
288 return $this->disk_quota;
289 }
$disk_quota
The disk quota in bytes.

References $disk_quota.

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

+ Here is the caller graph for this function:

◆ getParent()

ilObjRole::getParent ( )

get reference id of parent object

@access public

Returns
integer ref_id of parent object

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

385 {
386 return $this->parent;
387 }

References $parent.

Referenced by delete().

+ 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.

@access public

Returns
integer

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

315 {
317 }

References $wsp_disk_quota.

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

+ Here is the caller graph for this function:

◆ getPresentationTitle()

ilObjRole::getPresentationTitle ( )

return translated title for autogenerated roles

Returns

Reimplemented from ilObject.

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

125 {
126 return ilObjRole::_getTranslation($this->getTitle());
127 }
static _getTranslation($a_role_title)
getTitle()
get object title @access public

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

+ Here is the call graph for this function:

◆ isAutoGenerated()

static ilObjRole::isAutoGenerated (   $a_role_id)
static

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

602 {
603 return substr(ilObject::_lookupTitle($a_role_id), 0, 3) == 'il_';
604 }
static _lookupTitle($a_id)
lookup object title

References ilObject\_lookupTitle().

Referenced by ilObjRoleGUI\initFormRoleProperties().

+ 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 811 of file class.ilObjRole.php.

812 {
813 if (in_array($a_type, $a_exclusion_filter)) {
814 return false;
815 }
816
817 if (in_array('all', $a_filter)) {
818 return true;
819 }
820 return in_array($a_type, $a_filter);
821 }

References $a_type.

Referenced by adjustPermissions().

+ Here is the caller graph for this function:

◆ read()

ilObjRole::read ( )

loads "role" from database @access private

Reimplemented from ilObject.

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

155 {
156 global $ilDB;
157
158 $query = "SELECT * FROM role_data WHERE role_id= " . $ilDB->quote($this->id, 'integer') . " ";
159
160 $res = $ilDB->query($query);
161 if ($res->numRows() > 0) {
162 $data = $ilDB->fetchAssoc($res);
163
164 // fill member vars in one shot
165 $this->assignData($data);
166 } else {
167 $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);
168 }
169
170 parent::read();
171 }
assignData($a_data)
loads a record "role" from array @access public

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

Referenced by update().

+ 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

@access public

Parameters
integer

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

245 {
246 if (empty($a_allow_register)) {
247 $a_allow_register == 0;
248 }
249
250 $this->allow_register = (int) $a_allow_register;
251 }

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

+ 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.

@access public

Parameters
integer

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

273 {
274 $this->disk_quota = $a_disk_quota;
275 }

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

+ 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!!!

@access public

Parameters
integerref_id of parent object

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

374 {
375 $this->parent = $a_parent_ref;
376 }

◆ 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.

@access public

Parameters
integer

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

301 {
302 $this->wsp_disk_quota = $a_disk_quota;
303 }

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

+ Here is the caller graph for this function:

◆ toggleAssignUsersStatus()

ilObjRole::toggleAssignUsersStatus (   $a_assign_users)

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

130 {
131 $this->assign_users = (int) $a_assign_users;
132 }

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

+ Here is the caller graph for this function:

◆ update()

ilObjRole::update ( )

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

Reimplemented from ilObject.

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

193 {
194 global $ilDB;
195
196 $query = "UPDATE role_data SET " .
197 "allow_register= " . $ilDB->quote($this->allow_register, 'integer') . ", " .
198 "assign_users = " . $ilDB->quote($this->getAssignUsersStatus(), 'integer') . ", " .
199 "disk_quota = " . $ilDB->quote($this->getDiskQuota(), 'integer') . ", " .
200 "wsp_disk_quota = " . $ilDB->quote($this->getPersonalWorkspaceDiskQuota(), 'integer') . " " .
201 "WHERE role_id= " . $ilDB->quote($this->id, 'integer') . " ";
202 $res = $ilDB->manipulate($query);
203
205
206 $this->read();
207
208 return true;
209 }
read()
loads "role" from database @access private
update($pash, $contents, Config $config)

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

+ 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 829 of file class.ilObjRole.php.

830 {
831 global $rbacreview;
832
833 $has_policies = null;
834 $policy_origin = null;
835
836 if ($a_node == ROOT_FOLDER_ID) {
837 $has_policies = true;
838 $policy_origin = ROLE_FOLDER_ID;
839 } else {
840 $has_policies = $rbacreview->getLocalPolicies($a_node);
841 $policy_origin = $a_node;
842
843 if ($a_init) {
844 $parent_roles = $rbacreview->getParentRoleIds($a_node, false);
845 if ($parent_roles[$this->getId()]) {
846 $a_stack[] = $rbacreview->getAllOperationsOfRole(
847 $this->getId(),
848 $parent_roles[$this->getId()]['parent']
849 );
850 }
851 return true;
852 }
853 }
854
855 if (!$has_policies) {
856 return false;
857 }
858
859 $a_stack[] = $rbacreview->getAllOperationsOfRole(
860 $this->getId(),
861 $policy_origin
862 );
863 return true;
864 }

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

Referenced by adjustPermissions().

+ 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 871 of file class.ilObjRole.php.

872 {
873 global $rbacreview;
874
875 $has_policies = null;
876 $policy_origin = null;
877
878 if ($a_node == ROOT_FOLDER_ID) {
879 $has_policies = true;
880 $policy_origin = ROLE_FOLDER_ID;
881 } else {
882 $has_policies = $rbacreview->getLocalPolicies($a_node);
883 $policy_origin = $a_node;
884 }
885
886 if (!$has_policies) {
887 return false;
888 }
889
890 $a_stack[] = $policy_origin;
891 return true;
892 }

References ilObject\$rbacreview.

Referenced by adjustPermissions().

+ Here is the caller graph for this function:

◆ validate()

ilObjRole::validate ( )

Validate role data.

Returns
bool

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

110 {
111 global $ilErr;
112
113 if (substr($this->getTitle(), 0, 3) == 'il_') {
114 $ilErr->setMessage('msg_role_reserved_prefix');
115 return false;
116 }
117 return true;
118 }
global $ilErr
Definition: raiseError.php:16

References $ilErr, and ilObject\getTitle().

+ Here is the call graph for this function:

Field Documentation

◆ $allow_register

ilObjRole::$allow_register

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

◆ $assign_users

ilObjRole::$assign_users

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

◆ $disk_quota

ilObjRole::$disk_quota

The disk quota in bytes.

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

Referenced by getDiskQuota().

◆ $parent

ilObjRole::$parent

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

Referenced by getParent().

◆ $wsp_disk_quota

ilObjRole::$wsp_disk_quota

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

Referenced by getPersonalWorkspaceDiskQuota().

◆ MODE_PROTECTED_DELETE_LOCAL_POLICIES

◆ MODE_PROTECTED_KEEP_LOCAL_POLICIES

const ilObjRole::MODE_PROTECTED_KEEP_LOCAL_POLICIES = 2

◆ MODE_UNPROTECTED_DELETE_LOCAL_POLICIES

◆ MODE_UNPROTECTED_KEEP_LOCAL_POLICIES

const ilObjRole::MODE_UNPROTECTED_KEEP_LOCAL_POLICIES = 4

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