19 declare(strict_types=1);
36 [
"permission" =>
"read",
"cmd" =>
"render",
"lang_var" =>
"show",
"default" =>
true],
37 [
"permission" =>
"write",
"cmd" =>
"listRecords",
"lang_var" =>
"edit_content"],
38 [
"permission" =>
"write",
"cmd" =>
"edit",
"lang_var" =>
"settings"],
50 $ilAccess = $DIC[
'ilAccess'];
52 $t_arr = explode(
"_", $target);
55 if ($t_arr[0] !=
"dcl" ||
$ref_id <= 0) {
59 if ($ilAccess->checkAccess(
"read",
"",
$ref_id) ||
60 $ilAccess->checkAccess(
"visible",
"",
$ref_id)) {
71 if ($reference == $ref_id) {
83 $ilUser = $DIC[
'ilUser'];
85 $rbacsystem = $DIC[
'rbacsystem'];
86 $ilAccess = $DIC[
'ilAccess'];
96 && !$rbacsystem->checkAccessOfUser(
$user_id,
'write', $ref_id)
113 switch ($permission) {
117 && (!$rbacsystem->checkAccessOfUser(
$user_id,
'write', $ref_id))
136 $ilDB = $DIC->database();
138 $q =
"SELECT * FROM il_dcl_data WHERE id = " .
$ilDB->quote($a_id,
"integer");
140 $dcl_rec =
$ilDB->fetchAssoc($dcl_set);
142 return !is_null($dcl_rec) && $dcl_rec[
"is_online"];
157 $ilAccess = $DIC[
'ilAccess'];
162 if ($ilAccess->checkAccess(
"add_entry",
"", array_shift($references))) {
172 if (self::checkActionForRefId($action, $ref_id)) {
180 public static function checkActionForRefId(
string $action,
int $ref_id):
bool 183 $ilAccess = $DIC[
'ilAccess'];
189 return $ilAccess->checkAccess($action,
"", $ref_id);
199 $ilAccess = $DIC[
'ilAccess'];
202 return $ilAccess->checkAccessOfUser(
$user_id,
"write",
"", $ref);
205 return $ilAccess->checkAccess(
"write",
"", $ref);
211 $ilAccess = $DIC[
'ilAccess'];
214 return $ilAccess->checkAccessOfUser(
$user_id,
"write",
"", $ref);
217 return $ilAccess->checkAccess(
"edit_content",
"", $ref);
227 $ilAccess = $DIC[
'ilAccess'];
230 return $ilAccess->checkAccessOfUser(
$user_id,
"write",
"", $ref);
233 return $ilAccess->checkAccess(
"add_entry",
"", $ref);
243 $ilAccess = $DIC[
'ilAccess'];
246 return $ilAccess->checkAccessOfUser(
$user_id,
"write",
"", $ref);
249 return $ilAccess->checkAccess(
"read",
"", $ref);
255 $rbacreview = $DIC[
'rbacreview'];
256 $ilUser = $DIC[
'ilUser'];
258 $assigned_roles = $rbacreview->assignedRoles(
$user_id ?: $ilUser->getId());
259 $allowed_roles = $tableview->
getRoles();
261 return !empty(array_intersect($assigned_roles, $allowed_roles));
271 return self::hasWriteAccess($ref_id) || $table->getIsVisible();
274 public static function hasAccessTo(
int $ref_id,
int $table_id,
int $tableview_id):
bool 277 $tableview = ilDclTableView::find($tableview_id);
281 if (($tableview->getTableId() !== $table_id)
282 || !self::isTableInDataCollection($table, $ref_id)
288 return self::hasWriteAccess($ref_id)
290 self::hasReadAccess($ref_id) && self::hasAccessToTable($table_id, $ref_id) && self::hasAccessToTableView($tableview)
297 && (self::hasWriteAccess($ref_id));
302 return self::hasAccessToFields($ref_id, $table_id);
309 return in_array($field_id, $table->getFieldIds()) && self::hasAccessToFields($ref_id, $table_id);
315 if (!self::isTableInDataCollection($table, $ref_id)) {
const IL_NO_OBJECT_ACCESS
static hasAccessToTableView(ilDclTableView $tableview, ?int $user_id=0)
static hasAddRecordAccess(int $ref, ?int $user_id=0)
static _getAllReferences(int $id)
get all reference ids for object ID
static _getCommands()
get commands this method returns an array of all possible commands/permission combinations example: $...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static hasAccessToFields(int $ref_id, int $table_id)
_checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
static isTableInDataCollection(ilDclTable $table, int $ref_id)
static getTableCache(?int $table_id=null)
static hasAccessToField(int $ref_id, int $table_id, int $field_id)
static hasWriteAccess(int $ref, ?int $user_id=0)
static _checkGoto(string $target)
check whether goto script will succeed
static hasAccessToTable(int $table_id, int $ref_id)
returns true if either the table is visible for all users, or no tables are visible and this is the t...
static hasReadAccess(int $ref, ?int $user_id=0)
static hasPermissionToAddRecord(int $ref_id, int $table_id)
static hasAccessToEditTable(int $ref_id, int $table_id)
static hasEditAccess(int $ref, ?int $user_id=0)
static checkAccessForDataCollectionId(int $data_collection_id)
static _lookupOnline(int $a_id)
Check wether datacollection is online.
static checkActionForObjId(string $action, int $obj_id)