ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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())
 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...
 
 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...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! 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 ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 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 _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 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 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
 
 $ilias
 
 $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...
 

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

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

Member Function Documentation

◆ __getPermissionDefinitions()

ilObjRole::__getPermissionDefinitions ( )

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

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

596  {
597  global $ilDB, $lng, $objDefinition,$rbacreview;
598 
599  $operation_info = $rbacreview->getOperationAssignment();
600  foreach($operation_info as $info)
601  {
602  if($objDefinition->getDevMode($info['type']))
603  {
604  continue;
605  }
606  $rbac_objects[$info['typ_id']] = array("obj_id" => $info['typ_id'],
607  "type" => $info['type']);
608 
609  // handle plugin permission texts
610  $txt = $objDefinition->isPlugin($info['type'])
611  ? ilObjectPlugin::lookupTxtById($info['type'], $info['type']."_".$info['operation'])
612  : $lng->txt($info['type']."_".$info['operation']);
613  if (substr($info['operation'], 0, 7) == "create_" &&
614  $objDefinition->isPlugin(substr($info['operation'], 7)))
615  {
616  $txt = ilObjectPlugin::lookupTxtById(substr($info['operation'], 7), $info['type']."_".$info['operation']);
617  }
618  $rbac_operations[$info['typ_id']][$info['ops_id']] = array(
619  "ops_id" => $info['ops_id'],
620  "title" => $info['operation'],
621  "name" => $txt);
622 
623  }
624  return array($rbac_objects,$rbac_operations);
625  }
static lookupTxtById($plugin_id, $lang_var)
$info
Definition: example_052.php:80
$txt
Definition: error.php:12
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ _getAssignUsersStatus()

static ilObjRole::_getAssignUsersStatus (   $a_role_id)
static

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

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

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

143  {
144  global $ilDB;
145 
146  $query = "SELECT assign_users FROM role_data WHERE role_id = ".$ilDB->quote($a_role_id,'integer')." ";
147  $res = $ilDB->query($query);
148  while($row = $ilDB->fetchObject($res))
149  {
150  return $row->assign_users ? true : false;
151  }
152  return false;
153  }
global $ilDB
+ Here is the caller graph for this function:

◆ _getAuthMode()

static ilObjRole::_getAuthMode (   $a_role_id)
static

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

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

544  {
545  global $ilDB;
546 
547  $query = "SELECT auth_mode FROM role_data ".
548  "WHERE role_id= ".$ilDB->quote($a_role_id,'integer')." ";
549  $res = $ilDB->query($query);
550  $row = $ilDB->fetchAssoc($res);
551 
552  return $row['auth_mode'];
553  }
global $ilDB

◆ _getRolesByAuthMode()

static ilObjRole::_getRolesByAuthMode (   $a_auth_mode)
static

Get roles by auth mode.

public

Parameters
stringauth mode

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

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

Referenced by ilRadiusSettings\read().

563  {
564  global $ilDB;
565 
566  $query = "SELECT * FROM role_data ".
567  "WHERE auth_mode = ".$ilDB->quote($a_auth_mode,'text');
568  $res = $ilDB->query($query);
569  $roles = array();
570  while($row = $ilDB->fetchObject($res))
571  {
572  $roles[] = $row->role_id;
573  }
574  return $roles;
575  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _getTranslation()

static ilObjRole::_getTranslation (   $a_role_title)
static

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

References $ilDB, $query, and $res.

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

361  {
362  global $ilDB;
363 
364  $query = "SELECT * FROM role_data ".
365  " WHERE role_id =".$ilDB->quote($a_role_id,'integer');
366 
367  $res = $ilDB->query($query);
368  if ($role_rec = $ilDB->fetchAssoc($res))
369  {
370  if ($role_rec["allow_register"])
371  {
372  return true;
373  }
374  }
375  return false;
376  }
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 334 of file class.ilObjRole.php.

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

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

335  {
336  global $ilDB;
337 
338  $query = "SELECT * FROM role_data ".
339  "JOIN object_data ON object_data.obj_id = role_data.role_id ".
340  "WHERE allow_register = 1";
341  $res = $ilDB->query($query);
342 
343  $roles = array();
344  while($role = $ilDB->fetchAssoc($res))
345  {
346  $roles[] = array("id" => $role["obj_id"],
347  "title" => $role["title"],
348  "auth_mode" => $role['auth_mode']);
349  }
350 
351  return $roles;
352  }
Create styles array
The data for the language used.
global $ilDB
+ 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 585 of file class.ilObjRole.php.

References $ilDB, $query, and $res.

Referenced by ilRadiusSettings\save().

586  {
587  global $ilDB;
588 
589  $query = "UPDATE role_data SET auth_mode = 'default' WHERE auth_mode = ".$ilDB->quote($a_auth_mode,'text');
590  $res = $ilDB->manipulate($query);
591  }
global $ilDB
+ Here is the caller graph for this function:

◆ _updateAuthMode()

static ilObjRole::_updateAuthMode (   $a_roles)
static

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

References $ilDB, $query, and $res.

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

531  {
532  global $ilDB;
533 
534  foreach ($a_roles as $role_id => $auth_mode)
535  {
536  $query = "UPDATE role_data SET ".
537  "auth_mode= ".$ilDB->quote($auth_mode,'text')." ".
538  "WHERE role_id= ".$ilDB->quote($role_id,'integer')." ";
539  $res = $ilDB->manipulate($query);
540  }
541  }
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() 
)
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 710 of file class.ilObjRole.php.

References $GLOBALS, ilRbacLog\add(), array, 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().

711  {
712  global $rbacadmin, $rbacreview, $tree;
713 
714  $operation_stack = array();
715  $policy_stack = array();
716  $node_stack = array();
717 
718  $start_node = current($a_nodes);
719  array_push($node_stack,$start_node);
720  $this->updatePolicyStack($policy_stack, $start_node['child']);
721  $this->updateOperationStack($operation_stack, $start_node['child'],true);
722 
723  include_once "Services/AccessControl/classes/class.ilRbacLog.php";
724  $rbac_log_active = ilRbacLog::isActive();
725 
726  $local_policy = false;
727  foreach($a_nodes as $node)
728  {
729  $cmp_node = end($node_stack);
730  while($relation = $tree->getRelationOfNodes($node,$cmp_node))
731  {
732  switch($relation)
733  {
736  $GLOBALS['ilLog']->write(__METHOD__.': Handling sibling/none relation.');
737  array_pop($operation_stack);
738  array_pop($policy_stack);
739  array_pop($node_stack);
740  $cmp_node = end($node_stack);
741  $local_policy = false;
742  break;
743 
747  default:
748  $GLOBALS['ilLog']->write(__METHOD__.': Handling child/equals/parent '. $relation);
749  break 2;
750  }
751 
752  }
753 
754  if($local_policy)
755  {
756  continue;
757  }
758 
759  // Start node => set permissions and continue
760  if($node['child'] == $start_node['child'])
761  {
762  if($this->isHandledObjectType($a_filter,$a_exclusion_filter,$node['type']))
763  {
764  if($rbac_log_active)
765  {
766  $rbac_log_roles = $rbacreview->getParentRoleIds($node['child'], false);
767  $rbac_log_old = ilRbacLog::gatherFaPa($node['child'], array_keys($rbac_log_roles));
768  }
769 
770  // Set permissions
771  $perms = end($operation_stack);
772  $rbacadmin->grantPermission(
773  $this->getId(),
774  (array) $perms[$node['type']],
775  $node['child']
776  );
777 
778  if($rbac_log_active)
779  {
780  $rbac_log_new = ilRbacLog::gatherFaPa($node['child'], array_keys($rbac_log_roles));
781  $rbac_log = ilRbacLog::diffFaPa($rbac_log_old, $rbac_log_new);
782  ilRbacLog::add(ilRbacLog::EDIT_TEMPLATE_EXISTING, $node['child'], $rbac_log);
783  }
784  }
785  continue;
786  }
787 
788  // Node has local policies => update permission stack and continue
789  if(in_array($node['child'], $a_policies) and ($node['child'] != SYSTEM_FOLDER_ID))
790  {
791  $local_policy = true;
792  $this->updatePolicyStack($policy_stack, $node['child']);
793  $this->updateOperationStack($operation_stack, $node['child']);
794  array_push($node_stack, $node);
795  continue;
796  }
797 
798  // Continue if this object type is not in filter
799  if(!$this->isHandledObjectType($a_filter,$a_exclusion_filter,$node['type']))
800  {
801  continue;
802  }
803 
804  if($rbac_log_active)
805  {
806  $rbac_log_roles = $rbacreview->getParentRoleIds($node['child'], false);
807  $rbac_log_old = ilRbacLog::gatherFaPa($node['child'], array_keys($rbac_log_roles));
808  }
809 
810  // Node is course => create course permission intersection
811  if(($a_mode == self::MODE_UNPROTECTED_DELETE_LOCAL_POLICIES or
812  $a_mode == self::MODE_UNPROTECTED_KEEP_LOCAL_POLICIES) and ($node['type'] == 'crs'))
813 
814  {
815  // Copy role permission intersection
816  $perms = end($operation_stack);
817  $this->createPermissionIntersection($policy_stack,$perms['crs'],$node['child'],$node['type']);
818  if($this->updateOperationStack($operation_stack,$node['child']))
819  {
820  $this->updatePolicyStack($policy_stack, $node['child']);
821  array_push($node_stack, $node);
822  }
823  }
824 
825  // Node is group => create group permission intersection
826  if(($a_mode == self::MODE_UNPROTECTED_DELETE_LOCAL_POLICIES or
827  $a_mode == self::MODE_UNPROTECTED_KEEP_LOCAL_POLICIES) and ($node['type'] == 'grp'))
828  {
829  // Copy role permission intersection
830  $perms = end($operation_stack);
831  $this->createPermissionIntersection($policy_stack,$perms['grp'],$node['child'],$node['type']);
832  if($this->updateOperationStack($operation_stack,$node['child']))
833  {
834  $this->updatePolicyStack($policy_stack, $node['child']);
835  array_push($node_stack, $node);
836  }
837  }
838 
839  // Set permission
840  $perms = end($operation_stack);
841  $rbacadmin->grantPermission(
842  $this->getId(),
843  (array) $perms[$node['type']],
844  $node['child']
845  );
846 
847  if($rbac_log_active)
848  {
849  $rbac_log_new = ilRbacLog::gatherFaPa($node['child'], array_keys($rbac_log_roles));
850  $rbac_log = ilRbacLog::diffFaPa($rbac_log_old, $rbac_log_new);
851  ilRbacLog::add(ilRbacLog::EDIT_TEMPLATE_EXISTING, $node['child'], $rbac_log);
852  }
853  }
854  }
createPermissionIntersection($policy_stack, $a_current_ops, $a_id, $a_type)
Create course group permission intersection.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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
Create styles array
The data for the language used.
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
const EDIT_TEMPLATE_EXISTING
updateOperationStack(&$a_stack, $a_node, $a_init=false)
Update operation stack.
const RELATION_SIBLING
+ 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 186 of file class.ilObjRole.php.

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

Referenced by read().

187  {
188  $this->setTitle(ilUtil::stripSlashes($a_data["title"]));
189  $this->setDescription(ilUtil::stripslashes($a_data["desc"]));
190  $this->setAllowRegister($a_data["allow_register"]);
191  $this->toggleAssignUsersStatus($a_data['assign_users']);
192  $this->setDiskQuota($a_data['disk_quota']);
193  $this->setPersonalWorkspaceDiskQuota($a_data['wsp_disk_quota']);
194  }
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() 
)

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

References adjustPermissions(), array, deleteLocalPolicies(), and ilObject\getId().

641  {
642  global $tree,$rbacreview;
643 
644  // Get node info of subtree
645  $nodes = $tree->getRbacSubtreeInfo($a_start_node);
646 
647  // get local policies
648  $all_local_policies = $rbacreview->getObjectsWithStopedInheritance($this->getId());
649 
650  // filter relevant roles
651  $local_policies = array();
652  foreach($all_local_policies as $lp)
653  {
654  if(isset($nodes[$lp]))
655  {
656  $local_policies[] = $lp;
657  }
658  }
659 
660  // Delete deprecated policies
661  switch($a_mode)
662  {
663  case self::MODE_UNPROTECTED_DELETE_LOCAL_POLICIES:
664  case self::MODE_PROTECTED_DELETE_LOCAL_POLICIES:
665  $local_policies = $this->deleteLocalPolicies($a_start_node,$local_policies,$a_filter);
666  #$local_policies = array($a_start_node == ROOT_FOLDER_ID ? SYSTEM_FOLDER_ID : $a_start_node);
667  break;
668  }
669  $this->adjustPermissions($a_mode,$nodes,$local_policies,$a_filter,$a_exclusion_filter);
670 
671  #var_dump(memory_get_peak_usage());
672  #var_dump(memory_get_usage());
673  }
deleteLocalPolicies($a_start, $a_policies, $a_filter)
Delete local policies.
getId()
get object id public
Create styles array
The data for the language used.
adjustPermissions($a_mode, $a_nodes, $a_policies, $a_filter, $a_exclusion_filter=array())
Adjust permissions.
+ Here is the call graph for this function:

◆ create()

ilObjRole::create ( )

create

public

Returns
integer object id

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

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

227  {
228  global $ilDB;
229 
230  $this->id = parent::create();
231 
232  $query = "INSERT INTO role_data ".
233  "(role_id,allow_register,assign_users,disk_quota,wsp_disk_quota) ".
234  "VALUES ".
235  "(".$ilDB->quote($this->id,'integer').",".
236  $ilDB->quote($this->getAllowRegister(),'integer').",".
237  $ilDB->quote($this->getAssignUsersStatus(),'integer').",".
238  $ilDB->quote($this->getDiskQuota(),'integer').",".
239  $ilDB->quote($this->getPersonalWorkspaceDiskQuota(),'integer').")"
240  ;
241  $res = $ilDB->query($query);
242 
243  return $this->id;
244  }
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.
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 61 of file class.ilObjRole.php.

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

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

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

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

966  {
967  global $ilDB, $rbacreview,$rbacadmin;
968 
969  static $course_non_member_id = null;
970  static $group_non_member_id = null;
971  static $group_open_id = null;
972  static $group_closed_id = null;
973 
974  // Get template id
975  switch($a_type)
976  {
977  case 'grp':
978 
979  include_once './Modules/Group/classes/class.ilObjGroup.php';
981  #var_dump("GROUP TYPE",$type);
982  switch($type)
983  {
984  case GRP_TYPE_CLOSED:
985  if(!$group_closed_id)
986  {
987  $query = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_grp_status_closed'";
988  $res = $ilDB->query($query);
989  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
990  {
991  $group_closed_id = $row->obj_id;
992  }
993  }
994  $template_id = $group_closed_id;
995  #var_dump("GROUP CLOSED id:" . $template_id);
996  break;
997 
998  case GRP_TYPE_OPEN:
999  default:
1000  if(!$group_open_id)
1001  {
1002  $query = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_grp_status_open'";
1003  $res = $ilDB->query($query);
1004  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
1005  {
1006  $group_open_id = $row->obj_id;
1007  }
1008  }
1009  $template_id = $group_open_id;
1010  #var_dump("GROUP OPEN id:" . $template_id);
1011  break;
1012  }
1013  break;
1014 
1015  case 'crs':
1016  if(!$course_non_member_id)
1017  {
1018  $query = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_crs_non_member'";
1019  $res = $ilDB->query($query);
1020  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
1021  {
1022  $course_non_member_id = $row->obj_id;
1023  }
1024  }
1025  $template_id = $course_non_member_id;
1026  break;
1027  }
1028 
1029  $current_ops = $a_current_ops[$a_type];
1030 
1031  // Create intersection template permissions
1032  if($template_id)
1033  {
1034  //$rolf = $rbacreview->getRoleFolderIdOfObject($a_id);
1035 
1036  $rbacadmin->copyRolePermissionIntersection(
1037  $template_id, ROLE_FOLDER_ID,
1038  $this->getId(), end($policy_stack),
1039  $a_id,$this->getId()
1040  );
1041  }
1042  else
1043  {
1044  #echo "No template id for ".$a_id.' of type'.$a_type.'<br>';
1045  }
1046  #echo "ROLE ASSIGN: ".$rolf.' AID'.$a_id;
1047  if($a_id and !$GLOBALS['rbacreview']->isRoleAssignedToObject($this->getId(),$a_id))
1048  {
1049  $rbacadmin->assignRoleToFolder($this->getId(),$a_id,"n");
1050  }
1051  return true;
1052  }
const GRP_TYPE_OPEN
$template_id
Definition: example_062.php:89
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$a_type
Definition: workflow.php:93
getId()
get object id public
const GRP_TYPE_CLOSED
static _lookupObjId($a_id)
global $ilDB
static lookupGroupTye($a_id)
Lookup group type.
+ 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 408 of file class.ilObjRole.php.

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

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

References ilObject\_lookupObjId(), ilObject\_lookupType(), array, and ilObject\getId().

Referenced by changeExistingObjects().

681  {
682  global $rbacreview,$rbacadmin;
683 
684  $local_policies = array();
685  foreach($a_policies as $policy)
686  {
687  if($policy == $a_start or $policy == SYSTEM_FOLDER_ID)
688  {
689  $local_policies[] = $policy;
690  continue;
691  }
692  if(!in_array('all',$a_filter) and !in_array(ilObject::_lookupType(ilObject::_lookupObjId($policy)),$a_filter))
693  {
694  $local_policies[] = $policy;
695  continue;
696  }
697  $rbacadmin->deleteLocalRole($this->getId(),$policy);
698  }
699  return $local_policies;
700  }
getId()
get object id public
static _lookupObjId($a_id)
Create styles array
The data for the language used.
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 268 of file class.ilObjRole.php.

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

269  {
270  return $this->allow_register ? $this->allow_register : false;
271  }
+ Here is the caller graph for this function:

◆ getAssignUsersStatus()

ilObjRole::getAssignUsersStatus ( )

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

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

138  {
139  return $this->assign_users ? $this->assign_users : 0;
140  }
+ Here is the caller graph for this function:

◆ getCountMembers()

ilObjRole::getCountMembers ( )

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

502  {
503  global $rbacreview;
504 
505  return count($rbacreview->assignedUsers($this->getId()));
506  }

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

References $disk_quota.

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

296  {
297  return $this->disk_quota;
298  }
$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 396 of file class.ilObjRole.php.

References $parent.

Referenced by delete().

397  {
398  return $this->parent;
399  }
+ 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 323 of file class.ilObjRole.php.

References $wsp_disk_quota.

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

324  {
325  return $this->wsp_disk_quota;
326  }
+ Here is the caller graph for this function:

◆ getPresentationTitle()

ilObjRole::getPresentationTitle ( )

return translated title for autogenerated roles

Returns

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

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

129  {
130  return ilObjRole::_getTranslation($this->getTitle());
131  }
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 628 of file class.ilObjRole.php.

References ilObject\_lookupTitle().

Referenced by ilObjRoleGUI\initFormRoleProperties().

629  {
630  return substr(ilObject::_lookupTitle($a_role_id), 0, 3) == 'il_';
631  }
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 862 of file class.ilObjRole.php.

References $a_type.

Referenced by adjustPermissions().

863  {
864  if(in_array($a_type,$a_exclusion_filter))
865  {
866  return false;
867  }
868 
869  if(in_array('all',$a_filter))
870  {
871  return true;
872  }
873  return in_array($a_type,$a_filter);
874  }
$a_type
Definition: workflow.php:93
+ Here is the caller graph for this function:

◆ read()

ilObjRole::read ( )

loads "role" from database private

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

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

Referenced by update().

160  {
161  global $ilDB;
162 
163  $query = "SELECT * FROM role_data WHERE role_id= ".$ilDB->quote($this->id,'integer')." ";
164 
165  $res = $ilDB->query($query);
166  if ($res->numRows() > 0)
167  {
168  $data = $ilDB->fetchAssoc($res);
169 
170  // fill member vars in one shot
171  $this->assignData($data);
172  }
173  else
174  {
175  $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);
176  }
177 
178  parent::read();
179  }
redirection script todo: (a better solution should control the processing via a xml file) ...
global $ilDB
assignData($a_data)
loads a record "role" from array public
+ 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 252 of file class.ilObjRole.php.

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

253  {
254  if (empty($a_allow_register))
255  {
256  $a_allow_register == 0;
257  }
258 
259  $this->allow_register = (int) $a_allow_register;
260  }
+ 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
@param      integer 

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

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

282  {
283  $this->disk_quota = $a_disk_quota;
284  }
+ 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 385 of file class.ilObjRole.php.

386  {
387  $this->parent = $a_parent_ref;
388  }

◆ 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
@param      integer 

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

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

310  {
311  $this->wsp_disk_quota = $a_disk_quota;
312  }
+ Here is the caller graph for this function:

◆ toggleAssignUsersStatus()

ilObjRole::toggleAssignUsersStatus (   $a_assign_users)

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

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

134  {
135  $this->assign_users = (int) $a_assign_users;
136  }
+ Here is the caller graph for this function:

◆ update()

ilObjRole::update ( )

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

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

References $ilDB, $query, $res, getAssignUsersStatus(), getDiskQuota(), getPersonalWorkspaceDiskQuota(), and read().

201  {
202  global $ilDB;
203 
204  $query = "UPDATE role_data SET ".
205  "allow_register= ".$ilDB->quote($this->allow_register,'integer').", ".
206  "assign_users = ".$ilDB->quote($this->getAssignUsersStatus(),'integer').", ".
207  "disk_quota = ".$ilDB->quote($this->getDiskQuota(),'integer').", ".
208  "wsp_disk_quota = ".$ilDB->quote($this->getPersonalWorkspaceDiskQuota(),'integer')." ".
209  "WHERE role_id= ".$ilDB->quote($this->id,'integer')." ";
210  $res = $ilDB->manipulate($query);
211 
212  parent::update();
213 
214  $this->read();
215 
216  return true;
217  }
getPersonalWorkspaceDiskQuota()
Gets the minimal personal workspace disk quota imposed by this role.
getDiskQuota()
Gets the minimal disk quota imposed by this role.
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 882 of file class.ilObjRole.php.

References ilObject\getId().

Referenced by adjustPermissions().

883  {
884  global $rbacreview;
885 
886  $has_policies = null;
887  $policy_origin = null;
888 
889  if($a_node == ROOT_FOLDER_ID)
890  {
891  $has_policies = TRUE;
892  $policy_origin = ROLE_FOLDER_ID;
893  }
894  else
895  {
896  $has_policies = $rbacreview->getLocalPolicies($a_node);
897  $policy_origin = $a_node;
898 
899  if($a_init)
900  {
901  $parent_roles = $rbacreview->getParentRoleIds($a_node,false);
902  if($parent_roles[$this->getId()])
903  {
904  $a_stack[] = $rbacreview->getAllOperationsOfRole(
905  $this->getId(),
906  $parent_roles[$this->getId()]['parent']
907  );
908  }
909  return true;
910  }
911 
912  }
913 
914  if(!$has_policies)
915  {
916  return false;
917  }
918 
919  $a_stack[] = $rbacreview->getAllOperationsOfRole(
920  $this->getId(),
921  $policy_origin
922  );
923  return true;
924  }
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 931 of file class.ilObjRole.php.

Referenced by adjustPermissions().

932  {
933  global $rbacreview;
934 
935  $has_policies = null;
936  $policy_origin = null;
937 
938  if($a_node == ROOT_FOLDER_ID)
939  {
940  $has_policies = TRUE;
941  $policy_origin = ROLE_FOLDER_ID;
942  }
943  else
944  {
945  $has_policies = $rbacreview->getLocalPolicies($a_node);
946  $policy_origin = $a_node;
947  }
948 
949  if(!$has_policies)
950  {
951  return false;
952  }
953 
954  $a_stack[] = $policy_origin;
955  return true;
956  }
+ Here is the caller graph for this function:

◆ validate()

ilObjRole::validate ( )

Validate role data.

Returns
bool

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

References $ilErr, and ilObject\getTitle().

113  {
114  global $ilErr;
115 
116  if(substr($this->getTitle(),0,3) == 'il_')
117  {
118  $ilErr->setMessage('msg_role_reserved_prefix');
119  return false;
120  }
121  return true;
122  }
global $ilErr
Definition: raiseError.php:16
getTitle()
get object title public
+ 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: