ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilObjDataCollectionAccess Class Reference

Class ilObjDataCollectionAccess. More...

+ Inheritance diagram for ilObjDataCollectionAccess:
+ Collaboration diagram for ilObjDataCollectionAccess:

Public Member Functions

 _checkAccess ($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
 checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
- Public Member Functions inherited from ilObjectAccess
 _checkAccess ($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
 Checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
 _checkCondition ($a_obj_id, $a_operator, $a_value, $a_usr_id)
 check condition More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 
Parameters
ilWACPath$ilWACPath
Returns
bool
More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getCommands ()
 get commands More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
static _lookupOnline ($a_id)
 Check wether datacollection is online. More...
 
static checkAccessForDataCollectionId ($data_collection_id)
 
static checkActionForObjId ($action, $obj_id)
 
static hasWriteAccess ($ref, $user_id=0)
 
static hasEditAccess ($ref, $user_id=0)
 Has permission to view and edit all entries event when he is not the owner. More...
 
static hasAddRecordAccess ($ref, $user_id=0)
 
static hasReadAccess ($ref, $user_id=0)
 
static hasAccessToTableView ($tableview, $user_id=0)
 This only checks access to the tableview - if the full access check is required, use hasAccessTo($ref_id, $table_id, $tableview_id) More...
 
static hasAccessToFields ($ref_id, $table_id)
 
static hasAccessToEditTable ($ref_id, $table_id)
 
static hasAccessToField ($ref_id, $table_id, $field_id)
 
static hasPermissionToAddRecord ($ref_id, $table_id)
 
- Static Public Member Functions inherited from ilObjectAccess
static _getCommands ()
 get commands More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten if object type does not support centralized offline handling. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 

Static Protected Member Functions

static isTableInDataCollection ($table, $ref_id)
 
static hasAccessToTable ($table_id)
 returns true if either the table is visible for all users, or no tables are visible and this is the table with the lowest order (getFirstVisibleTableId()) More...
 

Detailed Description

Member Function Documentation

◆ _checkAccess()

ilObjDataCollectionAccess::_checkAccess (   $a_cmd,
  $a_permission,
  $a_ref_id,
  $a_obj_id,
  $a_user_id = "" 
)

checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess)

Parameters
string$a_cmdcommand (not permission!)
string$a_permissionpermission
int$a_ref_idreference id
int$a_obj_idobject id
int$a_user_iduser id (if not provided, current user is taken)
Returns
boolean true, if everything is ok

Reimplemented from ilObjectAccess.

Definition at line 95 of file class.ilObjDataCollectionAccess.php.

96 {
97 global $DIC;
98 $ilUser = $DIC['ilUser'];
99 $lng = $DIC['lng'];
100 $rbacsystem = $DIC['rbacsystem'];
101 $ilAccess = $DIC['ilAccess'];
102
103 if ($a_user_id == "") {
104 $a_user_id = $ilUser->getId();
105 }
106 switch ($a_cmd) {
107 case "view":
108
110 && !$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)
111 ) {
112 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
113
114 return false;
115 }
116 break;
117
118 // for permission query feature
119 case "infoScreen":
121 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
122 } else {
123 $ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("online"));
124 }
125 break;
126 }
127 switch ($a_permission) {
128 case "read":
129 case "visible":
131 && (!$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id))
132 ) {
133 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
134
135 return false;
136 }
137 break;
138 }
139
140 return true;
141 }
const IL_STATUS_MESSAGE
const IL_NO_OBJECT_ACCESS
static _lookupOnline($a_id)
Check wether datacollection is online.
$lng
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46

References $DIC, $ilUser, $lng, _lookupOnline(), IL_NO_OBJECT_ACCESS, and IL_STATUS_MESSAGE.

+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjDataCollectionAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

Definition at line 45 of file class.ilObjDataCollectionAccess.php.

46 {
47 global $DIC;
48 $ilAccess = $DIC['ilAccess'];
49
50 $t_arr = explode("_", $a_target);
51
52 if ($t_arr[0] != "dcl" || ((int) $t_arr[1]) <= 0) {
53 return false;
54 }
55
56 if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
57 $ilAccess->checkAccess("visible", "", $t_arr[1])) {
58 return true;
59 }
60
61 return false;
62 }

References $DIC.

◆ _getCommands()

static ilObjDataCollectionAccess::_getCommands ( )
static

get commands

this method returns an array of all possible commands/permission combinations

example: $commands = array ( array("permission" => "read", "cmd" => "view", "lang_var" => "show"), array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"), );

Reimplemented from ilObjectAccess.

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

31 {
32 $commands = array(
33 array("permission" => "read", "cmd" => "render", "lang_var" => "show", "default" => true),
34 array("permission" => "write", "cmd" => "listRecords", "lang_var" => "edit_content"),
35 array("permission" => "write", "cmd" => "edit", "lang_var" => "settings"),
36 );
37
38 return $commands;
39 }

Referenced by ilObjDataCollectionListGUI\init().

+ Here is the caller graph for this function:

◆ _lookupOnline()

static ilObjDataCollectionAccess::_lookupOnline (   $a_id)
static

Check wether datacollection is online.

Parameters
int$a_idwiki id

Definition at line 149 of file class.ilObjDataCollectionAccess.php.

150 {
151 global $DIC;
152 $ilDB = $DIC['ilDB'];
153
154 $q = "SELECT * FROM il_dcl_data WHERE id = " . $ilDB->quote($a_id, "integer");
155 $dcl_set = $ilDB->query($q);
156 $dcl_rec = $ilDB->fetchAssoc($dcl_set);
157
158 return $dcl_rec["is_online"];
159 }
global $ilDB

References $DIC, and $ilDB.

Referenced by _checkAccess(), ilObjDataCollectionListGUI\getProperties(), and ilContainer\legacyOnlineFilter().

+ Here is the caller graph for this function:

◆ checkAccessForDataCollectionId()

static ilObjDataCollectionAccess::checkAccessForDataCollectionId (   $data_collection_id)
static
Parameters
$data_collection_id

@depracated use checkActionForId instead

Returns
bool

Definition at line 171 of file class.ilObjDataCollectionAccess.php.

172 {
173 global $DIC;
174 $ilAccess = $DIC['ilAccess'];
175
176 $perm = false;
177 $references = ilObject2::_getAllReferences($data_collection_id);
178
179 if ($ilAccess->checkAccess("add_entry", "", array_shift($references))) {
180 $perm = true;
181 }
182
183 return $perm;
184 }
static _getAllReferences($a_id)
get all reference ids of object

References $DIC, and ilObject2\_getAllReferences().

+ Here is the call graph for this function:

◆ checkActionForObjId()

static ilObjDataCollectionAccess::checkActionForObjId (   $action,
  $obj_id 
)
static
Parameters
$action
$obj_id
Returns
bool

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

194 {
195 foreach (ilObject2::_getAllReferences($obj_id) as $ref_id) {
196 if (self::checkActionForRefId($action, $ref_id)) {
197 return true;
198 }
199 }
200
201 return false;
202 }

References ilObject2\_getAllReferences().

Referenced by ilDclTableEditGUI\save().

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

◆ hasAccessToEditTable()

static ilObjDataCollectionAccess::hasAccessToEditTable (   $ref_id,
  $table_id 
)
static
Parameters
$ref_id
$table_id
Returns
bool

Definition at line 394 of file class.ilObjDataCollectionAccess.php.

395 {
396 return self::hasAccessToFields($ref_id, $table_id);
397 }
static hasAccessToFields($ref_id, $table_id)

References hasAccessToFields().

Referenced by ilDclTableViewEditGUI\checkAccess(), ilDclFieldListGUI\checkAccess(), ilDclTableEditGUI\checkAccess(), and ilDclTableViewGUI\checkAccess().

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

◆ hasAccessToField()

static ilObjDataCollectionAccess::hasAccessToField (   $ref_id,
  $table_id,
  $field_id 
)
static
Parameters
$ref_id
$table_id
$field_id
Returns
bool

Definition at line 407 of file class.ilObjDataCollectionAccess.php.

408 {
409 $table = ilDclCache::getTableCache($table_id);
410
411 return in_array($field_id, $table->getFieldIds()) && self::hasAccessToFields($ref_id, $table_id);
412 }
static getTableCache($table_id=0)

References ilDclCache\getTableCache(), and hasAccessToFields().

Referenced by ilDclFieldEditGUI\checkAccess().

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

◆ hasAccessToFields()

static ilObjDataCollectionAccess::hasAccessToFields (   $ref_id,
  $table_id 
)
static
Parameters
$ref_id
$table_id
Returns
bool

Definition at line 381 of file class.ilObjDataCollectionAccess.php.

382 {
384 && (self::hasWriteAccess($ref_id));
385 }
static isTableInDataCollection($table, $ref_id)

References ilDclCache\getTableCache(), hasWriteAccess(), and isTableInDataCollection().

Referenced by ilDclFieldEditGUI\checkAccess(), ilDclFieldListTableGUI\fillRow(), hasAccessToEditTable(), and hasAccessToField().

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

◆ hasAccessToTable()

static ilObjDataCollectionAccess::hasAccessToTable (   $table_id)
staticprotected

returns true if either the table is visible for all users, or no tables are visible and this is the table with the lowest order (getFirstVisibleTableId())

Parameters
$table_id
Returns
bool

Definition at line 339 of file class.ilObjDataCollectionAccess.php.

340 {
341 $table = ilDclCache::getTableCache($table_id);
342
343 return $table->getIsVisible() || ($table_id == $table->getCollectionObject()->getFirstVisibleTableId());
344 }

References ilDclCache\getTableCache().

+ Here is the call graph for this function:

◆ hasAccessToTableView()

static ilObjDataCollectionAccess::hasAccessToTableView (   $tableview,
  $user_id = 0 
)
static

This only checks access to the tableview - if the full access check is required, use hasAccessTo($ref_id, $table_id, $tableview_id)

Parameters
integer | ilDclTableView$tableviewcan be object or id
int$user_id
Returns
bool

Definition at line 311 of file class.ilObjDataCollectionAccess.php.

312 {
313 global $DIC;
314 $rbacreview = $DIC['rbacreview'];
315 $ilUser = $DIC['ilUser'];
316 if (!$tableview) {
317 return false;
318 }
319
320 if (is_numeric($tableview)) {
321 $tableview = ilDclTableView::find($tableview);
322 }
323
324 $assigned_roles = $rbacreview->assignedRoles($user_id ? $user_id : $ilUser->getId());
325 $allowed_roles = $tableview->getRoles();
326
327 return !empty(array_intersect($assigned_roles, $allowed_roles));
328 }

References $DIC, and $ilUser.

Referenced by ilDclTable\getVisibleTableViews().

+ Here is the caller graph for this function:

◆ hasAddRecordAccess()

static ilObjDataCollectionAccess::hasAddRecordAccess (   $ref,
  $user_id = 0 
)
static
Parameters
$refint the reference id of the datacollection object to check.
int$user_id
Returns
bool whether or not the current user has admin/write access to the referenced datacollection

Definition at line 271 of file class.ilObjDataCollectionAccess.php.

272 {
273 global $DIC;
274 $ilAccess = $DIC['ilAccess'];
275
276 if ($user_id) {
277 return $ilAccess->checkAccessOfUser($user_id, "write", "", $ref);
278 }
279
280 return $ilAccess->checkAccess("add_entry", "", $ref);
281 }

References $DIC.

Referenced by ilDclRecordEditGUI\getRecord(), hasPermissionToAddRecord(), ilDclTable\hasPermissionToDeleteRecord(), ilDclTable\hasPermissionToDeleteRecords(), and ilDclTable\hasPermissionToEditRecord().

+ Here is the caller graph for this function:

◆ hasEditAccess()

static ilObjDataCollectionAccess::hasEditAccess (   $ref,
  $user_id = 0 
)
static

Has permission to view and edit all entries event when he is not the owner.

Parameters
$ref
int$user_id
Returns
mixed

Definition at line 252 of file class.ilObjDataCollectionAccess.php.

253 {
254 global $DIC;
255 $ilAccess = $DIC['ilAccess'];
256
257 if ($user_id) {
258 return $ilAccess->checkAccessOfUser($user_id, "write", "", $ref);
259 }
260
261 return $ilAccess->checkAccess("edit_content", "", $ref);
262 }

References $DIC.

Referenced by ilDclTable\hasPermissionToEditRecord(), and ilDclTable\hasPermissionToViewRecord().

+ Here is the caller graph for this function:

◆ hasPermissionToAddRecord()

static ilObjDataCollectionAccess::hasPermissionToAddRecord (   $ref_id,
  $table_id 
)
static
Parameters
int$ref_id
Returns
bool

Definition at line 421 of file class.ilObjDataCollectionAccess.php.

422 {
423 $table = ilDclCache::getTableCache($table_id);
424 if (!self::isTableInDataCollection($table, $ref_id)) {
425 return false;
426 }
427
429 || (ilObjDataCollectionAccess::hasAddRecordAccess($ref_id) && $table->getAddPerm() && $table->checkLimit());
430 }

References ilDclCache\getTableCache(), hasAddRecordAccess(), and hasWriteAccess().

Referenced by ilDclReferenceFieldRepresentation\getInputField(), ilDclRecordListGUI\importExcel(), and ilDclRecordEditGUI\save().

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

◆ hasReadAccess()

static ilObjDataCollectionAccess::hasReadAccess (   $ref,
  $user_id = 0 
)
static
Parameters
$refint the reference id of the datacollection object to check.
int$user_id
Returns
bool whether or not the current user has read access to the referenced datacollection

Definition at line 290 of file class.ilObjDataCollectionAccess.php.

291 {
292 global $DIC;
293 $ilAccess = $DIC['ilAccess'];
294
295 if ($user_id) {
296 return $ilAccess->checkAccessOfUser($user_id, "write", "", $ref);
297 }
298
299 return $ilAccess->checkAccess("read", "", $ref);
300 }

References $DIC.

Referenced by ilObjDataCollection\_hasReadAccess(), ilSoapDataCollectionAdministration\exportDataCollectionContent(), and ilDclTable\hasPermissionToViewRecord().

+ Here is the caller graph for this function:

◆ hasWriteAccess()

static ilObjDataCollectionAccess::hasWriteAccess (   $ref,
  $user_id = 0 
)
static
Parameters
$refint the reference id of the datacollection object to check.
int$user_id
Returns
bool whether or not the current user has admin/write access to the referenced datacollection

Definition at line 231 of file class.ilObjDataCollectionAccess.php.

232 {
233 global $DIC;
234 $ilAccess = $DIC['ilAccess'];
235
236 if ($user_id) {
237 return $ilAccess->checkAccessOfUser($user_id, "write", "", $ref);
238 }
239
240 return $ilAccess->checkAccess("write", "", $ref);
241 }

References $DIC.

Referenced by ilObjDataCollection\_hasWriteAccess(), ilDclTableEditGUI\checkAccess(), ilDclTableListGUI\checkAccess(), ilDclDetailedViewGUI\doExtReplace(), ilDclRecordListGUI\getAvailableTables(), ilDclTable\getVisibleTableViews(), hasAccessToFields(), hasPermissionToAddRecord(), ilDclTable\hasPermissionToDeleteRecord(), ilDclTable\hasPermissionToDeleteRecords(), ilDclTable\hasPermissionToEditRecord(), ilDclTable\hasPermissionToViewRecord(), ilDclRecordEditGUI\initForm(), and ilDclRecordEditGUI\save().

+ Here is the caller graph for this function:

◆ isTableInDataCollection()

static ilObjDataCollectionAccess::isTableInDataCollection (   $table,
  $ref_id 
)
staticprotected
Parameters
ilDclTable$table
$ref_id
Returns
bool

Definition at line 71 of file class.ilObjDataCollectionAccess.php.

72 {
73 foreach (ilObjDataCollection::_getAllReferences($table->getObjId()) as $reference) {
74 if ($reference == $ref_id) {
75 return true;
76 }
77 }
78
79 return false;
80 }

References ilObject2\_getAllReferences().

Referenced by hasAccessToFields().

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

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