ILIAS  trunk Revision v5.2.0beta1-34132-g2d4d73d4a0
ilAccess Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilAccess:
+ Collaboration diagram for ilAccess:

Public Member Functions

 __construct ()
 
 storeAccessResult (string $a_permission, string $a_cmd, int $a_ref_id, bool $a_access_granted, ?int $a_user_id=null, ?ilAccessInfo $a_info=null)
 store access result More...
 
 setPreventCachingLastResult (bool $a_val)
 Set prevent caching last result. More...
 
 getPreventCachingLastResult ()
 Get prevent caching last result. More...
 
 getStoredAccessResult (string $a_permission, string $a_cmd, int $a_ref_id, ?int $a_user_id=null)
 get stored access result
Parameters
string$a_permissionpermission
string$a_cmdcommand string
int$a_ref_idreference id
int | null$a_user_iduser id (if no id passed, current user id)
Returns
array<{granted: bool, info: ?ilAccessInfo, prevent_db_cache: bool}>
More...
 
 getResults ()
 
 setResults (array $a_results)
 
 addInfoItem (string $a_type, string $a_text, string $a_data="")
 add an info item to current info object More...
 
 checkAccess (string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
 check access for an object (provide $a_type and $a_obj_id if available for better performance) More...
 
 checkAccessOfUser (int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=0, ?int $a_tree_id=0)
 check access for an object (provide $a_type and $a_obj_id if available for better performance) More...
 
 getInfo ()
 get last info object
See also
ilAccessInfo::getInfoItems()
More...
 
 getResultLast ()
 get last info object More...
 
 getResultAll (int $a_ref_id=0)
 
 doCacheCheck (string $a_permission, string $a_cmd, int $a_ref_id, int $a_user_id)
 look if result for current query is already in cache
Returns
array<{hit: bool, granted: bool, prevent_db_cache: bool}>
More...
 
 doTreeCheck (string $a_permission, string $a_cmd, int $a_ref_id, int $a_user_id)
 check if object is in tree and not deleted More...
 
 doRBACCheck (string $a_permission, string $a_cmd, int $a_ref_id, int $a_user_id, string $a_type)
 rbac check for current object -> type is used for create permission More...
 
 doPathCheck (string $a_permission, string $a_cmd, int $a_ref_id, int $a_user_id, bool $a_all=false)
 check read permission for all parents More...
 
 doActivationCheck (string $a_permission, string $a_cmd, int $a_ref_id, int $a_user_id, int $a_obj_id, string $a_type)
 check for activation and centralized offline status. More...
 
 doConditionCheck (string $a_permission, string $a_cmd, int $a_ref_id, int $a_user_id, int $a_obj_id, string $a_type)
 condition check (currently only implemented for read permission) More...
 
 doStatusCheck (string $a_permission, string $a_cmd, int $a_ref_id, int $a_user_id, int $a_obj_id, string $a_type)
 object type specific check More...
 
 clear ()
 
 enable (string $a_str, bool $a_bool)
 
 filterUserIdsForCurrentUsersPositionsAndPermission (array $user_ids, string $permission)
 
Parameters
int[]$user_ids List of ILIAS-User-IDs which shall be filtered
string$permission
Returns
int[] Filtered List of ILIAS-User-IDs
Exceptions
More...
 
 filterUserIdsForUsersPositionsAndPermission (array $user_ids, int $for_user_id, string $permission)
 
Parameters
int[]$user_ids List of ILIAS-User-IDs which shall be filtered
int$for_user_id
string$permission
Returns
int[] Filtered List of ILIAS-User-IDs
Exceptions
More...
 
 isCurrentUserBasedOnPositionsAllowedTo (string $permission, array $on_user_ids)
 
Parameters
string$permission
int[]$on_user_ids List of ILIAS-User-IDs
Returns
bool
See also
getAvailablePositionRelatedPermissions for available permissions
More...
 
 isUserBasedOnPositionsAllowedTo (int $which_user_id, string $permission, array $on_user_ids)
 
Parameters
int$which_user_idPermission check for this ILIAS-User-ID
string$permission
int[]$on_user_ids List of ILIAS-User-IDs
Returns
bool
See also
getAvailablePositionRelatedPermissions for available permissions
More...
 
 checkPositionAccess (string $pos_perm, int $ref_id)
 
Parameters
string$pos_perm
int$ref_idReference-ID of the desired Object in the tree
Returns
bool
See also
getAvailablePositionRelatedPermissions for available permissions
More...
 
 checkRbacOrPositionPermissionAccess (string $rbac_perm, string $pos_perm, int $ref_id)
 
Parameters
string$rbac_perm
string$pos_permSee the list of available permissions in interface ilOrgUnitPositionAccessHandler
int$ref_idReference-ID of the desired Object in the tree
Returns
bool
More...
 
 filterUserIdsByPositionOfCurrentUser (string $pos_perm, int $ref_id, array $user_ids)
 
Parameters
string$pos_perm
int$ref_id
int[]$user_ids
Returns
int[]
See also
getAvailablePositionRelatedPermissions for available permissions
More...
 
 filterUserIdsByPositionOfUser (int $user_id, string $pos_perm, int $ref_id, array $user_ids)
 
Parameters
int$user_id
string$pos_perm
int$ref_id
int[]$user_ids
Returns
int[]
See also
getAvailablePositionRelatedPermissions for available permissions
More...
 
 filterUserIdsByRbacOrPositionOfCurrentUser (string $rbac_perm, string $pos_perm, int $ref_id, array $user_ids)
 
Parameters
string$rbac_perm
string$pos_permSee the list of available permissions in interface ilOrgUnitPositionAccessHandler
int$ref_idReference-ID of the desired Object in the tree
int[]$user_ids
Returns
int[]
More...
 
 hasCurrentUserAnyPositionAccess (int $ref_id)
 
Parameters
int$ref_id
Returns
bool
More...
 
 hasUserRBACorAnyPositionAccess (string $rbac_perm, int $ref_id)
 

Protected Attributes

ilOrgUnitPositionAccess $ilOrgUnitPositionAccess
 
array $obj_tree_cache
 
array $obj_type_cache
 
array $obj_id_cache
 
array $ac_cache
 
bool $status
 
bool $path
 
bool $condition
 
bool $tree
 
bool $rbac
 
bool $cache
 
ilAccessInfo $current_info
 
ilAccessInfo $last_info = null
 
array $results = []
 
array $last_result = []
 
array $stored_rbac_access = []
 
array $current_result_element = []
 
ilRbacSystem $rbacsystem
 
ilObjUser $user
 
ilLogger $ac_logger
 
ilDBInterface $db
 
ilTree $repositoryTree
 
ilObjectDefinition $objDefinition
 
ilLanguage $language = null
 

Private Member Functions

 getLanguage ()
 

Private Attributes

const MAX_CACHE_SIZE = 1000
 
bool $prevent_caching_last_result = false
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilAccessHandler Checks access for ILIAS objects

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Sascha Hofmann sasch.nosp@m.ahof.nosp@m.mann@.nosp@m.gmx..nosp@m.de

Definition at line 27 of file class.ilAccess.php.

Constructor & Destructor Documentation

◆ __construct()

ilAccess::__construct ( )

Definition at line 62 of file class.ilAccess.php.

References $DIC, ilLoggerFactory\getLogger(), ILIAS\Repository\rbac(), ILIAS\Repository\repositoryTree(), and ILIAS\Repository\user().

63  {
64  global $DIC;
65 
66  $this->user = $DIC->user();
67  $this->db = $DIC->database();
68  $this->rbacsystem = $DIC['rbacsystem'];
69  $this->results = [];
70  $this->current_info = new ilAccessInfo();
71  $this->repositoryTree = $DIC->repositoryTree();
72  $this->objDefinition = $DIC['objDefinition'];
73 
74  // use function enable to switch on/off tests (only cache is used so far)
75  $this->cache = true;
76  $this->rbac = true;
77  $this->tree = true;
78  $this->condition = true;
79  $this->path = true;
80  $this->status = true;
81  $this->obj_id_cache = [];
82  $this->obj_type_cache = [];
83  $this->obj_tree_cache = [];
84  $this->ac_cache = [];
85 
87 
88  $this->ac_logger = ilLoggerFactory::getLogger('ac');
89  }
static getLogger(string $a_component_id)
Get component logger.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$DIC
Definition: xapitoken.php:62
+ Here is the call graph for this function:

Member Function Documentation

◆ addInfoItem()

ilAccess::addInfoItem ( string  $a_type,
string  $a_text,
string  $a_data = "" 
)

add an info item to current info object

Implements ilRBACAccessHandler.

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

185  : void
186  {
187  $this->current_info->addInfoItem($a_type, $a_text, $a_data);
188  }

◆ checkAccess()

ilAccess::checkAccess ( string  $a_permission,
string  $a_cmd,
int  $a_ref_id,
string  $a_type = "",
?int  $a_obj_id = null,
?int  $a_tree_id = null 
)

check access for an object (provide $a_type and $a_obj_id if available for better performance)

Implements ilRBACAccessHandler.

Definition at line 193 of file class.ilAccess.php.

References checkAccessOfUser(), and ILIAS\Repository\user().

Referenced by ilSessionClassificationPathGUI\findSessionContainerForItem().

200  : bool {
201  return $this->checkAccessOfUser(
202  $this->user->getId(),
203  $a_permission,
204  $a_cmd,
205  $a_ref_id,
206  $a_type,
207  $a_obj_id,
208  $a_tree_id
209  );
210  }
checkAccessOfUser(int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=0, ?int $a_tree_id=0)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAccessOfUser()

ilAccess::checkAccessOfUser ( int  $a_user_id,
string  $a_permission,
string  $a_cmd,
int  $a_ref_id,
string  $a_type = "",
?int  $a_obj_id = 0,
?int  $a_tree_id = 0 
)

check access for an object (provide $a_type and $a_obj_id if available for better performance)

Implements ilRBACAccessHandler.

Definition at line 215 of file class.ilAccess.php.

References $DIC, ilObject\_lookupObjId(), ilObject\_lookupType(), doActivationCheck(), doCacheCheck(), doConditionCheck(), doPathCheck(), doRBACCheck(), doStatusCheck(), doTreeCheck(), getLanguage(), ilAccessInfo\IL_NO_PERMISSION, setPreventCachingLastResult(), and storeAccessResult().

Referenced by checkAccess(), doActivationCheck(), doConditionCheck(), doPathCheck(), and ilExerciseDerivedTaskProvider\getFirstRefIdWithPermission().

223  : bool {
224  global $DIC;
225 
226  $ilBench = $DIC['ilBench'];
227 
228  $this->setPreventCachingLastResult(false); // for external db based caches
229 
230  $ilBench->start("AccessControl", "0400_clear_info");
231  $this->current_info->clear();
232  $ilBench->stop("AccessControl", "0400_clear_info");
233 
234  // get stored result (internal memory based cache)
235  $cached = $this->doCacheCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id);
236  if ($cached["hit"]) {
237  // Store access result
238  if (!$cached["granted"]) {
239  $this->current_info->addInfoItem(ilAccessInfo::IL_NO_PERMISSION, $this->getLanguage()->txt("status_no_permission"));
240  }
241  if ($cached["prevent_db_cache"]) {
242  $this->setPreventCachingLastResult(true); // should have been saved in previous call already
243  }
244  return $cached["granted"];
245  }
246 
247  $ilBench->start("AccessControl", "0500_lookup_id_and_type");
248  // get object id if not provided
249  if ($a_obj_id == 0) {
250  if (isset($this->obj_id_cache[$a_ref_id]) && $this->obj_id_cache[$a_ref_id] > 0) {
251  $a_obj_id = $this->obj_id_cache[$a_ref_id];
252  } else {
253  $a_obj_id = ilObject::_lookupObjId($a_ref_id);
254  $this->obj_id_cache[$a_ref_id] = $a_obj_id;
255  }
256  }
257  if ($a_type == "") {
258  if (isset($this->obj_type_cache[$a_ref_id]) && $this->obj_type_cache[$a_ref_id] != "") {
259  $a_type = $this->obj_type_cache[$a_ref_id];
260  } else {
261  $a_type = ilObject::_lookupType($a_ref_id, true);
262  $this->obj_type_cache[$a_ref_id] = $a_type;
263  }
264  }
265 
266  $ilBench->stop("AccessControl", "0500_lookup_id_and_type");
267 
268  // if supplied tree id is not = 1 (= repository main tree),
269  // check if object is in tree and not deleted
270  if ($a_tree_id != 1 &&
271  !$this->doTreeCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id)) {
272  $this->current_info->addInfoItem(ilAccessInfo::IL_NO_PERMISSION, $this->getLanguage()->txt("status_no_permission"));
273  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
274  return false;
275  }
276 
277  // rbac check for current object
278  if (!$this->doRBACCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id, $a_type)) {
279  $this->current_info->addInfoItem(ilAccessInfo::IL_NO_PERMISSION, $this->getLanguage()->txt("status_no_permission"));
280  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
281  return false;
282  }
283 
284  // Check object activation
285  $act_check = $this->doActivationCheck(
286  $a_permission,
287  $a_cmd,
288  $a_ref_id,
289  $a_user_id,
290  $a_obj_id,
291  $a_type
292  );
293 
294  if (!$act_check) {
295  $this->current_info->addInfoItem(ilAccessInfo::IL_NO_PERMISSION, $this->getLanguage()->txt('status_no_permission'));
296  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
297  return false;
298  }
299 
300  // check read permission for all parents
301  $par_check = $this->doPathCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id);
302  if (!$par_check) {
303  $this->current_info->addInfoItem(ilAccessInfo::IL_NO_PERMISSION, $this->getLanguage()->txt("status_no_permission"));
304  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
305  return false;
306  }
307 
308  // condition check (currently only implemented for read permission)
309  if (!$this->doConditionCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id, $a_obj_id, $a_type)) {
310  $this->current_info->addInfoItem(ilAccessInfo::IL_NO_PERMISSION, $this->getLanguage()->txt("status_no_permission"));
311  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
312  $this->setPreventCachingLastResult(true); // do not store this in db, since condition updates are not monitored
313  return false;
314  }
315 
316  // object type specific check
317  if (!$this->doStatusCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id, $a_obj_id, $a_type)) {
318  $this->current_info->addInfoItem(ilAccessInfo::IL_NO_PERMISSION, $this->getLanguage()->txt("status_no_permission"));
319  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
320  $this->setPreventCachingLastResult(true); // do not store this in db, since status updates are not monitored
321  return false;
322  }
323 
324  // all checks passed
325  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, true, $a_user_id);
326  return true;
327  }
doCacheCheck(string $a_permission, string $a_cmd, int $a_ref_id, int $a_user_id)
look if result for current query is already in cachearray<{hit: bool, granted: bool, prevent_db_cache: bool}>
storeAccessResult(string $a_permission, string $a_cmd, int $a_ref_id, bool $a_access_granted, ?int $a_user_id=null, ?ilAccessInfo $a_info=null)
store access result
doStatusCheck(string $a_permission, string $a_cmd, int $a_ref_id, int $a_user_id, int $a_obj_id, string $a_type)
object type specific check
static _lookupObjId(int $ref_id)
setPreventCachingLastResult(bool $a_val)
Set prevent caching last result.
$DIC
Definition: xapitoken.php:62
doTreeCheck(string $a_permission, string $a_cmd, int $a_ref_id, int $a_user_id)
check if object is in tree and not deleted
doPathCheck(string $a_permission, string $a_cmd, int $a_ref_id, int $a_user_id, bool $a_all=false)
check read permission for all parents
doConditionCheck(string $a_permission, string $a_cmd, int $a_ref_id, int $a_user_id, int $a_obj_id, string $a_type)
condition check (currently only implemented for read permission)
doActivationCheck(string $a_permission, string $a_cmd, int $a_ref_id, int $a_user_id, int $a_obj_id, string $a_type)
check for activation and centralized offline status.
static _lookupType(int $id, bool $reference=false)
doRBACCheck(string $a_permission, string $a_cmd, int $a_ref_id, int $a_user_id, string $a_type)
rbac check for current object -> type is used for create permission
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkPositionAccess()

ilAccess::checkPositionAccess ( string  $pos_perm,
int  $ref_id 
)

Parameters
string$pos_perm
int$ref_idReference-ID of the desired Object in the tree
Returns
bool
See also
getAvailablePositionRelatedPermissions for available permissions

Implements ilOrgUnitPositionAccessHandler.

Definition at line 768 of file class.ilAccess.php.

References ilOrgUnitPositionAccess\checkPositionAccess().

768  : bool
769  {
770  return $this->ilOrgUnitPositionAccess->checkPositionAccess($pos_perm, $ref_id);
771  }
checkPositionAccess(string $pos_perm, int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

◆ checkRbacOrPositionPermissionAccess()

ilAccess::checkRbacOrPositionPermissionAccess ( string  $rbac_perm,
string  $pos_perm,
int  $ref_id 
)

Parameters
string$rbac_perm
string$pos_permSee the list of available permissions in interface ilOrgUnitPositionAccessHandler
int$ref_idReference-ID of the desired Object in the tree
Returns
bool

Implements ilOrgUnitPositionAndRBACAccessHandler.

Definition at line 776 of file class.ilAccess.php.

References ilOrgUnitPositionAccess\checkRbacOrPositionPermissionAccess().

776  : bool
777  {
778  return $this->ilOrgUnitPositionAccess->checkRbacOrPositionPermissionAccess($rbac_perm, $pos_perm, $ref_id);
779  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:65
checkRbacOrPositionPermissionAccess(string $rbac_perm, string $pos_perm, int $ref_id)
+ Here is the call graph for this function:

◆ clear()

ilAccess::clear ( )

Implements ilRBACAccessHandler.

Definition at line 699 of file class.ilAccess.php.

699  : void
700  {
701  $this->results = [];
702  $this->last_result = [];
703  $this->current_info = new ilAccessInfo();
704  $this->stored_rbac_access = [];
705  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ doActivationCheck()

ilAccess::doActivationCheck ( string  $a_permission,
string  $a_cmd,
int  $a_ref_id,
int  $a_user_id,
int  $a_obj_id,
string  $a_type 
)

check for activation and centralized offline status.

Implements ilRBACAccessHandler.

Definition at line 512 of file class.ilAccess.php.

References checkAccessOfUser(), ilMemberViewSettings\getInstance(), ilObjectActivation\getItem(), ilObject\lookupOfflineStatus(), ilObjectActivation\TIMINGS_ACTIVATION, and ILIAS\Repository\user().

Referenced by checkAccessOfUser().

519  : bool {
520  $cache_perm = ($a_permission === "visible" || $a_permission === 'leave')
521  ? "visible"
522  : "other";
523 
524  if (isset($this->ac_cache[$cache_perm][$a_ref_id][$a_user_id])) {
525  return $this->ac_cache[$cache_perm][$a_ref_id][$a_user_id];
526  }
527 
528  // nothings needs to be done if current permission is write permission
529  if ($a_permission === 'write') {
530  return true;
531  }
532 
533  // #10852 - member view check
534  if ($a_user_id === $this->user->getId()) {
535  // #10905 - activate parent container ONLY
537  if ($memview->isActiveForRefId($a_ref_id) &&
538  $memview->getContainer() == $a_ref_id) {
539  return true;
540  }
541  }
542 
543  // in any case, if user has write permission return true
544  if ($this->checkAccessOfUser($a_user_id, "write", "", $a_ref_id)) {
545  $this->ac_cache[$cache_perm][$a_ref_id][$a_user_id] = true;
546  return true;
547  }
548 
549  // no write access => check centralized offline status
550  if (
551  $this->objDefinition->supportsOfflineHandling($a_type) &&
553  ) {
554  $this->ac_cache[$cache_perm][$a_ref_id][$a_user_id] = false;
555  return false;
556  }
557  $item_data = ilObjectActivation::getItem($a_ref_id);
558  // if activation isn't enabled
559  if ($item_data === null || (is_array($item_data) && count($item_data) == 0) ||
560  $item_data['timing_type'] != ilObjectActivation::TIMINGS_ACTIVATION) {
561  $this->ac_cache[$cache_perm][$a_ref_id][$a_user_id] = true;
562  return true;
563  }
564  // if within activation time
565  if (($item_data['timing_start'] == 0 || time() >= $item_data['timing_start']) and
566  ($item_data['timing_end'] == 0 || time() <= $item_data['timing_end'])) {
567  $this->ac_cache[$cache_perm][$a_ref_id][$a_user_id] = true;
568  return true;
569  }
570 
571  // if user has write permission
572  if ($this->checkAccessOfUser($a_user_id, "write", "", $a_ref_id)) {
573  $this->ac_cache[$cache_perm][$a_ref_id][$a_user_id] = true;
574  return true;
575  }
576 
577  // if current permission is visible or leave and visible is set in activation
578  if (($a_permission === 'visible' || $a_permission === 'leave')
579  && $item_data['visible']) {
580  $this->ac_cache[$cache_perm][$a_ref_id][$a_user_id] = true;
581  return true;
582  }
583 
584  // learning progress must be readable, regardless of the activation
585  if ($a_permission == 'read_learning_progress') {
586  $this->ac_cache[$cache_perm][$a_ref_id][$a_user_id] = true;
587  return true;
588  }
589  // no access
590  $this->ac_cache[$cache_perm][$a_ref_id][$a_user_id] = false;
591  return false;
592  }
static lookupOfflineStatus(int $obj_id)
Lookup offline status using objectDataCache.
static getItem(int $ref_id)
checkAccessOfUser(int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=0, ?int $a_tree_id=0)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doCacheCheck()

ilAccess::doCacheCheck ( string  $a_permission,
string  $a_cmd,
int  $a_ref_id,
int  $a_user_id 
)

look if result for current query is already in cache

Returns
array<{hit: bool, granted: bool, prevent_db_cache: bool}>

Implements ilRBACAccessHandler.

Definition at line 360 of file class.ilAccess.php.

References getStoredAccessResult().

Referenced by checkAccessOfUser().

360  : array
361  {
362  $stored_access = $this->getStoredAccessResult($a_permission, $a_cmd, $a_ref_id, $a_user_id);
363 
364  //var_dump($stored_access);
365  if ($stored_access !== []) {
366  if (isset($stored_access['info']) && $stored_access['info'] instanceof ilAccessInfo) {
367  $this->current_info = $stored_access["info"];
368  }
369  //var_dump("cache-treffer:");
370  return [
371  "hit" => true,
372  "granted" => $stored_access["granted"],
373  "prevent_db_cache" => $stored_access["prevent_db_cache"]
374  ];
375  }
376 
377  // not in cache
378  return [
379  "hit" => false,
380  "granted" => false,
381  "prevent_db_cache" => false
382  ];
383  }
getStoredAccessResult(string $a_permission, string $a_cmd, int $a_ref_id, ?int $a_user_id=null)
get stored access resultpermission command string reference id user id (if no id passed, current user id) array<{granted: bool, info: ?ilAccessInfo, prevent_db_cache: bool}>
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doConditionCheck()

ilAccess::doConditionCheck ( string  $a_permission,
string  $a_cmd,
int  $a_ref_id,
int  $a_user_id,
int  $a_obj_id,
string  $a_type 
)

condition check (currently only implemented for read permission)

Implements ilRBACAccessHandler.

Definition at line 597 of file class.ilAccess.php.

References ilConditionHandler\_checkAllConditionsOfTarget(), ilObject\_lookupTitle(), checkAccessOfUser(), getLanguage(), and ilAccessInfo\IL_MISSING_PRECONDITION.

Referenced by checkAccessOfUser().

604  : bool {
605  if (
606  ($a_permission == 'visible') &&
607  !$this->checkAccessOfUser($a_user_id, "write", "", $a_ref_id, $a_type, $a_obj_id)
608  ) {
609  if (ilConditionHandler::lookupEffectiveHiddenStatusByTarget($a_ref_id)) {
610  if (!ilConditionHandler::_checkAllConditionsOfTarget($a_ref_id, $a_obj_id, $a_type, $a_user_id)) {
611  $conditions = ilConditionHandler::_getEffectiveConditionsOfTarget($a_ref_id, $a_obj_id, $a_type);
612  foreach ($conditions as $condition) {
613  $this->current_info->addInfoItem(
615  $this->getLanguage()->txt("missing_precondition") . ": " .
616  ilObject::_lookupTitle($condition["trigger_obj_id"]) . " " .
617  $this->getLanguage()->txt("condition_" . $condition["operator"]) . " " .
618  $condition["value"],
619  serialize($condition)
620  );
621  }
622  return false;
623  }
624  }
625  }
626 
627  if (($a_permission == "read" or $a_permission == 'join') &&
628  !$this->checkAccessOfUser($a_user_id, "write", "", $a_ref_id, $a_type, $a_obj_id)) {
629  if (!ilConditionHandler::_checkAllConditionsOfTarget($a_ref_id, $a_obj_id, $a_type, $a_user_id)) {
630  $conditions = ilConditionHandler::_getEffectiveConditionsOfTarget($a_ref_id, $a_obj_id, $a_type);
631  foreach ($conditions as $condition) {
632  $this->current_info->addInfoItem(
634  $this->getLanguage()->txt("missing_precondition") . ": " .
635  ilObject::_lookupTitle($condition["trigger_obj_id"]) . " " .
636  $this->getLanguage()->txt("condition_" . $condition["operator"]) . " " .
637  $condition["value"],
638  serialize($condition)
639  );
640  }
641  return false;
642  }
643  }
644  return true;
645  }
const IL_MISSING_PRECONDITION
bool $condition
static _lookupTitle(int $obj_id)
static _checkAllConditionsOfTarget(int $a_target_ref_id, int $a_target_id, string $a_target_type="", int $a_usr_id=0)
checks wether all conditions of a target object are fulfilled
checkAccessOfUser(int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=0, ?int $a_tree_id=0)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doPathCheck()

ilAccess::doPathCheck ( string  $a_permission,
string  $a_cmd,
int  $a_ref_id,
int  $a_user_id,
bool  $a_all = false 
)

check read permission for all parents

Implements ilRBACAccessHandler.

Definition at line 482 of file class.ilAccess.php.

References $id, checkAccessOfUser(), getLanguage(), ilAccessInfo\IL_NO_PARENT_ACCESS, and ILIAS\Repository\repositoryTree().

Referenced by checkAccessOfUser().

488  : bool {
489  $path = $this->repositoryTree->getPathId($a_ref_id);
490  foreach ($path as $id) {
491  if ($a_ref_id === $id) {
492  continue;
493  }
494  $access = $this->checkAccessOfUser($a_user_id, "read", "info", $id);
495  if ($access == false) {
496  $this->current_info->addInfoItem(
498  $this->getLanguage()->txt("no_parent_access"),
499  (string) $id
500  );
501  if ($a_all == false) {
502  return false;
503  }
504  }
505  }
506  return true;
507  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
checkAccessOfUser(int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=0, ?int $a_tree_id=0)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doRBACCheck()

ilAccess::doRBACCheck ( string  $a_permission,
string  $a_cmd,
int  $a_ref_id,
int  $a_user_id,
string  $a_type 
)

rbac check for current object -> type is used for create permission

Implements ilRBACAccessHandler.

Definition at line 439 of file class.ilAccess.php.

References $message, getLanguage(), ilAccessInfo\IL_NO_PERMISSION, and storeAccessResult().

Referenced by checkAccessOfUser().

445  : bool {
446  if ($a_permission == "") {
447  $message = sprintf(
448  '%s::doRBACCheck(): No operations given! $a_ref_id: %s',
449  get_class($this),
450  $a_ref_id
451  );
452  $this->ac_logger->error($message);
453  throw new ilPermissionException($message);
454  }
455 
456  if (isset($this->stored_rbac_access[$a_user_id . "-" . $a_permission . "-" . $a_ref_id])) {
457  $access = $this->stored_rbac_access[$a_user_id . "-" . $a_permission . "-" . $a_ref_id];
458  } else {
459  $access = $this->rbacsystem->checkAccessOfUser($a_user_id, $a_permission, $a_ref_id, $a_type);
460  if (!is_array($this->stored_rbac_access) || count($this->stored_rbac_access) < self::MAX_CACHE_SIZE) {
461  if ($a_permission != "create") {
462  $this->stored_rbac_access[$a_user_id . "-" . $a_permission . "-" . $a_ref_id] = $access;
463  }
464  }
465  }
466  // Store in result cache
467  if (!$access) {
468  $this->current_info->addInfoItem(
470  $this->getLanguage()->txt("status_no_permission")
471  );
472  }
473  if ($a_permission != "create") {
474  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, true, $a_user_id);
475  }
476  return $access;
477  }
storeAccessResult(string $a_permission, string $a_cmd, int $a_ref_id, bool $a_access_granted, ?int $a_user_id=null, ?ilAccessInfo $a_info=null)
store access result
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$message
Definition: xapiexit.php:32
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doStatusCheck()

ilAccess::doStatusCheck ( string  $a_permission,
string  $a_cmd,
int  $a_ref_id,
int  $a_user_id,
int  $a_obj_id,
string  $a_type 
)

object type specific check

Implements ilRBACAccessHandler.

Definition at line 650 of file class.ilAccess.php.

References $location, and storeAccessResult().

Referenced by checkAccessOfUser().

657  : bool {
658  // check for a deactivated plugin
659  if ($this->objDefinition->isPluginTypeName($a_type) && !$this->objDefinition->isPlugin($a_type)) {
660  return false;
661  }
662  if (!$a_type) {
663  return false;
664  }
665 
666  $class = $this->objDefinition->getClassName($a_type);
667  $location = $this->objDefinition->getLocation($a_type);
668  $full_class = "ilObj" . $class . "Access";
669 
670  if ($class == "") {
671  $this->ac_logger->error("Cannot find class for object type $a_type, obj id $a_obj_id, ref id $a_ref_id. Abort status check.");
672  return false;
673  }
674 
675  $full_class = new $full_class();
676 
677  $obj_access = call_user_func(
678  [$full_class, "_checkAccess"],
679  $a_cmd,
680  $a_permission,
681  $a_ref_id,
682  $a_obj_id,
683  $a_user_id
684  );
685  if ($obj_access !== true) {
686  //Note: We must not add an info item here, because one is going
687  // to be added by the user function we just called a few
688  // lines above.
689  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
690  return false;
691  }
692  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, true, $a_user_id);
693  return true;
694  }
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
storeAccessResult(string $a_permission, string $a_cmd, int $a_ref_id, bool $a_access_granted, ?int $a_user_id=null, ?ilAccessInfo $a_info=null)
store access result
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doTreeCheck()

ilAccess::doTreeCheck ( string  $a_permission,
string  $a_cmd,
int  $a_ref_id,
int  $a_user_id 
)

check if object is in tree and not deleted

Implements ilRBACAccessHandler.

Definition at line 388 of file class.ilAccess.php.

References getLanguage(), ilAccessInfo\IL_DELETED, ilAccessInfo\IL_NO_PERMISSION, ILIAS\Repository\repositoryTree(), and storeAccessResult().

Referenced by checkAccessOfUser().

388  : bool
389  {
390  // Get stored result
391  $tree_cache_key = $a_user_id . ':' . $a_ref_id;
392  if (array_key_exists($tree_cache_key, $this->obj_tree_cache)) {
393  // Store access result
394  if (!$this->obj_tree_cache[$tree_cache_key]) {
395  $this->current_info->addInfoItem(
397  $this->getLanguage()->txt("status_no_permission")
398  );
399  }
400  $this->storeAccessResult(
401  $a_permission,
402  $a_cmd,
403  $a_ref_id,
404  $this->obj_tree_cache[$tree_cache_key],
405  $a_user_id
406  );
407 
408  return $this->obj_tree_cache[$tree_cache_key];
409  }
410 
411  if (!$this->repositoryTree->isInTree($a_ref_id) || $this->repositoryTree->isDeleted($a_ref_id)) {
412  // Store negative access results
413  // Store in tree cache
414  // Note, we only store up to 1000 results to avoid memory overflow.
415  if (count($this->obj_tree_cache) < self::MAX_CACHE_SIZE) {
416  $this->obj_tree_cache[$tree_cache_key] = false;
417  }
418 
419  // Store in result cache
420  $this->current_info->addInfoItem(ilAccessInfo::IL_DELETED, $this->getLanguage()->txt("object_deleted"));
421  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, false, $a_user_id);
422  return false;
423  }
424 
425  // Store positive access result.
426  // Store in tree cache
427  // Note, we only store up to 1000 results to avoid memory overflow.
428  if (count($this->obj_tree_cache) < self::MAX_CACHE_SIZE) {
429  $this->obj_tree_cache[$tree_cache_key] = true;
430  }
431  // Store in result cache
432  $this->storeAccessResult($a_permission, $a_cmd, $a_ref_id, true, $a_user_id);
433  return true;
434  }
storeAccessResult(string $a_permission, string $a_cmd, int $a_ref_id, bool $a_access_granted, ?int $a_user_id=null, ?ilAccessInfo $a_info=null)
store access result
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enable()

ilAccess::enable ( string  $a_str,
bool  $a_bool 
)

Todo:
check for valid properties

Implements ilRBACAccessHandler.

Definition at line 711 of file class.ilAccess.php.

711  : void
712  {
713  $this->$a_str = $a_bool;
714  }

◆ filterUserIdsByPositionOfCurrentUser()

ilAccess::filterUserIdsByPositionOfCurrentUser ( string  $pos_perm,
int  $ref_id,
array  $user_ids 
)

Parameters
string$pos_perm
int$ref_id
int[]$user_ids
Returns
int[]
See also
getAvailablePositionRelatedPermissions for available permissions

Implements ilOrgUnitPositionAccessHandler.

Definition at line 784 of file class.ilAccess.php.

References ilOrgUnitPositionAccess\filterUserIdsByPositionOfCurrentUser().

784  : array
785  {
786  return $this->ilOrgUnitPositionAccess->filterUserIdsByPositionOfCurrentUser($pos_perm, $ref_id, $user_ids);
787  }
filterUserIdsByPositionOfCurrentUser(string $pos_perm, int $ref_id, array $user_ids)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

◆ filterUserIdsByPositionOfUser()

ilAccess::filterUserIdsByPositionOfUser ( int  $user_id,
string  $pos_perm,
int  $ref_id,
array  $user_ids 
)

Parameters
int$user_id
string$pos_perm
int$ref_id
int[]$user_ids
Returns
int[]
See also
getAvailablePositionRelatedPermissions for available permissions

Implements ilOrgUnitPositionAccessHandler.

Definition at line 792 of file class.ilAccess.php.

References ilOrgUnitPositionAccess\filterUserIdsByPositionOfUser().

792  : array
793  {
794  return $this->ilOrgUnitPositionAccess->filterUserIdsByPositionOfUser($user_id, $pos_perm, $ref_id, $user_ids);
795  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:65
filterUserIdsByPositionOfUser(int $user_id, string $pos_perm, int $ref_id, array $user_ids)
+ Here is the call graph for this function:

◆ filterUserIdsByRbacOrPositionOfCurrentUser()

ilAccess::filterUserIdsByRbacOrPositionOfCurrentUser ( string  $rbac_perm,
string  $pos_perm,
int  $ref_id,
array  $user_ids 
)

Parameters
string$rbac_perm
string$pos_permSee the list of available permissions in interface ilOrgUnitPositionAccessHandler
int$ref_idReference-ID of the desired Object in the tree
int[]$user_ids
Returns
int[]

Implements ilOrgUnitPositionAndRBACAccessHandler.

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

References ilOrgUnitPositionAccess\filterUserIdsByRbacOrPositionOfCurrentUser().

800  : array
801  {
803  $rbac_perm,
804  $pos_perm,
805  $ref_id,
806  $user_ids
807  );
808  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:65
filterUserIdsByRbacOrPositionOfCurrentUser(string $rbac_perm, string $pos_perm, int $ref_id, array $user_ids)
+ Here is the call graph for this function:

◆ filterUserIdsForCurrentUsersPositionsAndPermission()

ilAccess::filterUserIdsForCurrentUsersPositionsAndPermission ( array  $user_ids,
string  $permission 
)

Parameters
int[]$user_ids List of ILIAS-User-IDs which shall be filtered
string$permission
Returns
int[] Filtered List of ILIAS-User-IDs
Exceptions

Implements ilOrgUnitPositionAccessHandler.

Definition at line 725 of file class.ilAccess.php.

References ilOrgUnitPositionAccess\filterUserIdsForCurrentUsersPositionsAndPermission().

725  : array
726  {
728  $user_ids,
729  $permission
730  );
731  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
filterUserIdsForCurrentUsersPositionsAndPermission(array $user_ids, string $permission)
+ Here is the call graph for this function:

◆ filterUserIdsForUsersPositionsAndPermission()

ilAccess::filterUserIdsForUsersPositionsAndPermission ( array  $user_ids,
int  $for_user_id,
string  $permission 
)

Parameters
int[]$user_ids List of ILIAS-User-IDs which shall be filtered
int$for_user_id
string$permission
Returns
int[] Filtered List of ILIAS-User-IDs
Exceptions

Implements ilOrgUnitPositionAccessHandler.

Definition at line 736 of file class.ilAccess.php.

References ilOrgUnitPositionAccess\filterUserIdsForUsersPositionsAndPermission().

736  : array
737  {
739  $user_ids,
740  $for_user_id,
741  $permission
742  );
743  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
filterUserIdsForUsersPositionsAndPermission(array $user_ids, int $for_user_id, string $permission)
+ Here is the call graph for this function:

◆ getInfo()

ilAccess::getInfo ( )

get last info object

See also
ilAccessInfo::getInfoItems()

Implements ilRBACAccessHandler.

Definition at line 332 of file class.ilAccess.php.

332  : array
333  {
334  return is_object($this->last_info) ? $this->last_info->getInfoItems() : [];
335  }

◆ getLanguage()

ilAccess::getLanguage ( )
private

Definition at line 91 of file class.ilAccess.php.

References $DIC, $language, and ILIAS\UI\examples\Symbol\Glyph\Language\language().

Referenced by checkAccessOfUser(), doConditionCheck(), doPathCheck(), doRBACCheck(), and doTreeCheck().

91  : ilLanguage
92  {
93  if ($this->language === null) {
94  global $DIC;
95  $this->language = $DIC['lng'];
96  }
97 
98  return $this->language;
99  }
ilLanguage $language
$DIC
Definition: xapitoken.php:62
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPreventCachingLastResult()

ilAccess::getPreventCachingLastResult ( )

Get prevent caching last result.

Implements ilRBACAccessHandler.

Definition at line 143 of file class.ilAccess.php.

References $prevent_caching_last_result.

Referenced by storeAccessResult().

143  : bool
144  {
146  }
bool $prevent_caching_last_result
+ Here is the caller graph for this function:

◆ getResultAll()

ilAccess::getResultAll ( int  $a_ref_id = 0)

Implements ilRBACAccessHandler.

Definition at line 348 of file class.ilAccess.php.

References $results.

348  : array
349  {
350  if ($a_ref_id == "") {
351  return $this->results;
352  }
353 
354  return $this->results[$a_ref_id];
355  }
array $results

◆ getResultLast()

ilAccess::getResultLast ( )

get last info object

Implements ilRBACAccessHandler.

Definition at line 340 of file class.ilAccess.php.

References $last_result.

340  : array
341  {
342  return $this->last_result;
343  }
array $last_result

◆ getResults()

ilAccess::getResults ( )

Implements ilRBACAccessHandler.

Definition at line 169 of file class.ilAccess.php.

References $results.

169  : array
170  {
171  return $this->results;
172  }
array $results

◆ getStoredAccessResult()

ilAccess::getStoredAccessResult ( string  $a_permission,
string  $a_cmd,
int  $a_ref_id,
?int  $a_user_id = null 
)

get stored access result

Parameters
string$a_permissionpermission
string$a_cmdcommand string
int$a_ref_idreference id
int | null$a_user_iduser id (if no id passed, current user id)
Returns
array<{granted: bool, info: ?ilAccessInfo, prevent_db_cache: bool}>

Implements ilRBACAccessHandler.

Definition at line 151 of file class.ilAccess.php.

References ILIAS\Repository\user().

Referenced by doCacheCheck().

156  : array {
157  if ($a_user_id === null) {
158  $a_user_id = $this->user->getId();
159  }
160  if (isset($this->results[$a_ref_id][$a_permission][$a_cmd][$a_user_id])) {
161  return $this->results[$a_ref_id][$a_permission][$a_cmd][$a_user_id];
162  }
163  return [];
164  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasCurrentUserAnyPositionAccess()

ilAccess::hasCurrentUserAnyPositionAccess ( int  $ref_id)

Parameters
int$ref_id
Returns
bool

Implements ilOrgUnitPositionAccessHandler.

Definition at line 813 of file class.ilAccess.php.

References ilOrgUnitPositionAccess\hasCurrentUserAnyPositionAccess().

813  : bool
814  {
816  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

◆ hasUserRBACorAnyPositionAccess()

ilAccess::hasUserRBACorAnyPositionAccess ( string  $rbac_perm,
int  $ref_id 
)

Implements ilOrgUnitPositionAndRBACAccessHandler.

Definition at line 821 of file class.ilAccess.php.

References ilOrgUnitPositionAccess\hasUserRBACorAnyPositionAccess().

821  : bool
822  {
824  }
hasUserRBACorAnyPositionAccess(string $rbac_perm, int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

◆ isCurrentUserBasedOnPositionsAllowedTo()

ilAccess::isCurrentUserBasedOnPositionsAllowedTo ( string  $permission,
array  $on_user_ids 
)

Parameters
string$permission
int[]$on_user_ids List of ILIAS-User-IDs
Returns
bool
See also
getAvailablePositionRelatedPermissions for available permissions

Implements ilOrgUnitPositionAccessHandler.

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

References ilOrgUnitPositionAccess\isCurrentUserBasedOnPositionsAllowedTo().

748  : bool
749  {
750  return $this->ilOrgUnitPositionAccess->isCurrentUserBasedOnPositionsAllowedTo($permission, $on_user_ids);
751  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isCurrentUserBasedOnPositionsAllowedTo(string $permission, array $on_user_ids)
+ Here is the call graph for this function:

◆ isUserBasedOnPositionsAllowedTo()

ilAccess::isUserBasedOnPositionsAllowedTo ( int  $which_user_id,
string  $permission,
array  $on_user_ids 
)

Parameters
int$which_user_idPermission check for this ILIAS-User-ID
string$permission
int[]$on_user_ids List of ILIAS-User-IDs
Returns
bool
See also
getAvailablePositionRelatedPermissions for available permissions

Implements ilOrgUnitPositionAccessHandler.

Definition at line 756 of file class.ilAccess.php.

References ilOrgUnitPositionAccess\isUserBasedOnPositionsAllowedTo().

756  : bool
757  {
759  $which_user_id,
760  $permission,
761  $on_user_ids
762  );
763  }
isUserBasedOnPositionsAllowedTo(int $which_user_id, string $permission, array $on_user_ids)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ setPreventCachingLastResult()

ilAccess::setPreventCachingLastResult ( bool  $a_val)

Set prevent caching last result.

Implements ilRBACAccessHandler.

Definition at line 135 of file class.ilAccess.php.

Referenced by checkAccessOfUser().

135  : void
136  {
137  $this->prevent_caching_last_result = $a_val;
138  }
+ Here is the caller graph for this function:

◆ setResults()

ilAccess::setResults ( array  $a_results)

Implements ilRBACAccessHandler.

Definition at line 177 of file class.ilAccess.php.

177  : void
178  {
179  $this->results = $a_results;
180  }

◆ storeAccessResult()

ilAccess::storeAccessResult ( string  $a_permission,
string  $a_cmd,
int  $a_ref_id,
bool  $a_access_granted,
?int  $a_user_id = null,
?ilAccessInfo  $a_info = null 
)

store access result

Implements ilRBACAccessHandler.

Definition at line 104 of file class.ilAccess.php.

References $current_info, getPreventCachingLastResult(), and ILIAS\Repository\user().

Referenced by checkAccessOfUser(), doRBACCheck(), doStatusCheck(), and doTreeCheck().

111  : void {
112  if ($a_user_id === null) {
113  $a_user_id = $this->user->getId();
114  }
115  if ($a_info === null) {
116  $a_info = $this->current_info;
117  }
118  if ($this->cache) {
119  $this->results[$a_ref_id][$a_permission][$a_cmd][$a_user_id] = [
120  "granted" => $a_access_granted,
121  "info" => $a_info,
122  "prevent_db_cache" => $this->getPreventCachingLastResult()
123  ];
124  $this->current_result_element = [$a_access_granted, $a_ref_id, $a_permission, $a_cmd, $a_user_id];
125  $this->last_result = $this->results[$a_ref_id][$a_permission][$a_cmd][$a_user_id];
126  $this->last_info = $a_info;
127  }
128  // get new info object
129  $this->current_info = new ilAccessInfo();
130  }
ilAccessInfo $current_info
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getPreventCachingLastResult()
Get prevent caching last result.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ac_cache

array ilAccess::$ac_cache
protected

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

◆ $ac_logger

ilLogger ilAccess::$ac_logger
protected

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

◆ $cache

bool ilAccess::$cache
protected

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

◆ $condition

bool ilAccess::$condition
protected

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

◆ $current_info

ilAccessInfo ilAccess::$current_info
protected

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

Referenced by storeAccessResult().

◆ $current_result_element

array ilAccess::$current_result_element = []
protected

Definition at line 51 of file class.ilAccess.php.

◆ $db

ilDBInterface ilAccess::$db
protected

Definition at line 56 of file class.ilAccess.php.

◆ $ilOrgUnitPositionAccess

ilOrgUnitPositionAccess ilAccess::$ilOrgUnitPositionAccess
protected

Definition at line 31 of file class.ilAccess.php.

◆ $language

ilLanguage ilAccess::$language = null
protected

Definition at line 60 of file class.ilAccess.php.

Referenced by getLanguage().

◆ $last_info

ilAccessInfo ilAccess::$last_info = null
protected

Definition at line 47 of file class.ilAccess.php.

◆ $last_result

array ilAccess::$last_result = []
protected

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

Referenced by getResultLast().

◆ $obj_id_cache

array ilAccess::$obj_id_cache
protected

Definition at line 34 of file class.ilAccess.php.

◆ $obj_tree_cache

array ilAccess::$obj_tree_cache
protected

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

◆ $obj_type_cache

array ilAccess::$obj_type_cache
protected

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

◆ $objDefinition

ilObjectDefinition ilAccess::$objDefinition
protected

Definition at line 58 of file class.ilAccess.php.

◆ $path

bool ilAccess::$path
protected

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

◆ $prevent_caching_last_result

bool ilAccess::$prevent_caching_last_result = false
private

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

Referenced by getPreventCachingLastResult().

◆ $rbac

bool ilAccess::$rbac
protected

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

◆ $rbacsystem

ilRbacSystem ilAccess::$rbacsystem
protected

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

◆ $repositoryTree

ilTree ilAccess::$repositoryTree
protected

Definition at line 57 of file class.ilAccess.php.

◆ $results

array ilAccess::$results = []
protected

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

Referenced by getResultAll(), and getResults().

◆ $status

bool ilAccess::$status
protected

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

◆ $stored_rbac_access

array ilAccess::$stored_rbac_access = []
protected

Definition at line 50 of file class.ilAccess.php.

◆ $tree

bool ilAccess::$tree
protected

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

◆ $user

ilObjUser ilAccess::$user
protected

Definition at line 54 of file class.ilAccess.php.

◆ MAX_CACHE_SIZE

const ilAccess::MAX_CACHE_SIZE = 1000
private

Definition at line 29 of file class.ilAccess.php.


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