ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjectAccess.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
32 {
40  public function _checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id = null): bool
41  {
42 
43  // add no access info item and return false if access is not granted
44  // $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $a_text, $a_data = "");
45  //
46  // for all RBAC checks use checkAccessOfUser instead the normal checkAccess-method:
47  // $rbacsystem->checkAccessOfUser($a_user_id, $a_permission, $a_ref_id)
48 
49  return true;
50  }
51 
65  public static function _getCommands(): array
66  {
67  return [];
68  }
69 
73  public static function _checkGoto(string $target): bool
74  {
75  global $DIC;
76  $ilAccess = $DIC->access();
77 
78  $arr = explode("_", $target);
79 
80  if (
81  $ilAccess->checkAccess("read", "", (int) $arr[1]) ||
82  $ilAccess->checkAccess("visible", "", (int) $arr[1])
83  ) {
84  return true;
85  }
86  return false;
87  }
88 
95  public static function _isOffline(int $obj_id): bool
96  {
97  global $DIC;
98 
99  $objDefinition = $DIC['objDefinition'];
100  if ($objDefinition->supportsOfflineHandling(ilObject::_lookupType($obj_id))) {
101  return ilObject::lookupOfflineStatus($obj_id);
102  }
103  return false;
104  }
105 
109  public static function _preloadData(array $obj_ids, array $ref_ids): void
110  {
111  }
112 
116  public function canBeDelivered(ilWACPath $ilWACPath): bool
117  {
118  global $ilAccess;
119 
120  if (preg_match("/\\/obj_([\\d]*)\\//uism", $ilWACPath->getPath(), $results)) {
121  foreach (ilObject2::_getAllReferences((int) $results[1]) as $ref_id) {
122  if ($ilAccess->checkAccess('visible', '', $ref_id) || $ilAccess->checkAccess('read', '', $ref_id)) {
123  return true;
124  }
125  }
126  }
127 
128  return false;
129  }
130 }
_checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
Checks whether a user may invoke a command or not (this method is called by ilAccessHandler::checkAcc...
static _getAllReferences(int $id)
get all reference ids for object ID
static _preloadData(array $obj_ids, array $ref_ids)
Preload data.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupOfflineStatus(int $obj_id)
Lookup offline status using objectDataCache.
static _checkGoto(string $target)
check whether goto script will succeed
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
static _getCommands()
get commands
$results
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _isOffline(int $obj_id)
Type-specific implementation of general status, has to be overwritten if object type does not support...
static _lookupType(int $id, bool $reference=false)
canBeDelivered(ilWACPath $ilWACPath)