ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 

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

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

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

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

◆ _checkGoto()

static ilObjDataCollectionAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

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

References $DIC.

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  return true;
58  }
59 
60  return false;
61  }
global $DIC
Definition: saml.php:7

◆ _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"), );

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

Referenced by ilObjDataCollectionListGUI\init().

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  }
+ 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 147 of file class.ilObjDataCollectionAccess.php.

References $DIC, and $ilDB.

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

148  {
149  global $DIC;
150  $ilDB = $DIC['ilDB'];
151 
152  $q = "SELECT * FROM il_dcl_data WHERE id = " . $ilDB->quote($a_id, "integer");
153  $dcl_set = $ilDB->query($q);
154  $dcl_rec = $ilDB->fetchAssoc($dcl_set);
155 
156  return $dcl_rec["is_online"];
157  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ checkAccessForDataCollectionId()

static ilObjDataCollectionAccess::checkAccessForDataCollectionId (   $data_collection_id)
static
Parameters
$data_collection_iduse checkActionForId instead
Returns
bool

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

References $DIC, and ilObject2\_getAllReferences().

170  {
171  global $DIC;
172  $ilAccess = $DIC['ilAccess'];
173 
174  $perm = false;
175  $references = ilObject2::_getAllReferences($data_collection_id);
176 
177  if ($ilAccess->checkAccess("add_entry", "", array_shift($references))) {
178  $perm = true;
179  }
180 
181  return $perm;
182  }
global $DIC
Definition: saml.php:7
static _getAllReferences($a_id)
+ 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 191 of file class.ilObjDataCollectionAccess.php.

References $action, $DIC, and ilObject2\_getAllReferences().

Referenced by ilDclTableEditGUI\save().

192  {
193  foreach (ilObject2::_getAllReferences($obj_id) as $ref_id) {
194  if (self::checkActionForRefId($action, $ref_id)) {
195  return true;
196  }
197  }
198 
199  return false;
200  }
$action
static _getAllReferences($a_id)
+ 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 389 of file class.ilObjDataCollectionAccess.php.

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

390  {
391  return self::hasAccessToFields($ref_id, $table_id);
392  }
+ 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 402 of file class.ilObjDataCollectionAccess.php.

References $table, and ilDclCache\getTableCache().

Referenced by ilDclFieldEditGUI\checkAccess().

403  {
404  $table = ilDclCache::getTableCache($table_id);
405  return in_array($field_id, $table->getFieldIds()) && self::hasAccessToFields($ref_id, $table_id);
406  }
static getTableCache($table_id=0)
if(empty($password)) $table
Definition: pwgen.php:24
+ 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 376 of file class.ilObjDataCollectionAccess.php.

References ilDclCache\getTableCache().

Referenced by ilDclFieldEditGUI\checkAccess(), ilDclRecordListGUI\executeCommand(), and ilDclFieldListTableGUI\fillRow().

377  {
378  return self::isTableInDataCollection(ilDclCache::getTableCache($table_id), $ref_id)
379  && (self::hasWriteAccess($ref_id));
380  }
static getTableCache($table_id=0)
+ 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 337 of file class.ilObjDataCollectionAccess.php.

References $table, and ilDclCache\getTableCache().

338  {
339  $table = ilDclCache::getTableCache($table_id);
340  return $table->getIsVisible() || ($table_id == $table->getCollectionObject()->getFirstVisibleTableId());
341  }
static getTableCache($table_id=0)
if(empty($password)) $table
Definition: pwgen.php:24
+ 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 309 of file class.ilObjDataCollectionAccess.php.

References $DIC, and $ilUser.

Referenced by ilDclTable\getVisibleTableViews().

310  {
311  global $DIC;
312  $rbacreview = $DIC['rbacreview'];
313  $ilUser = $DIC['ilUser'];
314  if (!$tableview) {
315  return false;
316  }
317 
318  if (is_numeric($tableview)) {
319  $tableview = ilDclTableView::find($tableview);
320  }
321 
322  $assigned_roles = $rbacreview->assignedRoles($user_id ? $user_id : $ilUser->getId());
323  $allowed_roles = $tableview->getRoles();
324 
325  return !empty(array_intersect($assigned_roles, $allowed_roles));
326  }
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18
+ 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 269 of file class.ilObjDataCollectionAccess.php.

References $DIC.

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

270  {
271  global $DIC;
272  $ilAccess = $DIC['ilAccess'];
273 
274  if ($user_id) {
275  return $ilAccess->checkAccessOfUser($user_id, "write", "", $ref);
276  }
277 
278  return $ilAccess->checkAccess("add_entry", "", $ref);
279  }
global $DIC
Definition: saml.php:7
+ 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 250 of file class.ilObjDataCollectionAccess.php.

References $DIC.

Referenced by ilDclTable\_hasFieldByTitle(), ilDclRecordEditGUI\cancelSave(), ilDclTable\hasPermissionToEditRecord(), and ilDclTable\hasPermissionToViewRecord().

251  {
252  global $DIC;
253  $ilAccess = $DIC['ilAccess'];
254 
255  if ($user_id) {
256  return $ilAccess->checkAccessOfUser($user_id, "write", "", $ref);
257  }
258 
259  return $ilAccess->checkAccess("edit_content", "", $ref);
260  }
global $DIC
Definition: saml.php:7
+ 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 414 of file class.ilObjDataCollectionAccess.php.

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

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

415  {
416  $table = ilDclCache::getTableCache($table_id);
417  if (!self::isTableInDataCollection($table, $ref_id)) {
418  return false;
419  }
420 
422  || (ilObjDataCollectionAccess::hasAddRecordAccess($ref_id) && $table->getAddPerm() && $table->checkLimit());
423  }
static getTableCache($table_id=0)
if(empty($password)) $table
Definition: pwgen.php:24
+ 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 288 of file class.ilObjDataCollectionAccess.php.

References $DIC.

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

289  {
290  global $DIC;
291  $ilAccess = $DIC['ilAccess'];
292 
293  if ($user_id) {
294  return $ilAccess->checkAccessOfUser($user_id, "write", "", $ref);
295  }
296 
297  return $ilAccess->checkAccess("read", "", $ref);
298  }
global $DIC
Definition: saml.php:7
+ 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 229 of file class.ilObjDataCollectionAccess.php.

References $DIC.

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

230  {
231  global $DIC;
232  $ilAccess = $DIC['ilAccess'];
233 
234  if ($user_id) {
235  return $ilAccess->checkAccessOfUser($user_id, "write", "", $ref);
236  }
237 
238  return $ilAccess->checkAccess("write", "", $ref);
239  }
global $DIC
Definition: saml.php:7
+ 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 70 of file class.ilObjDataCollectionAccess.php.

References $table, and ilObject2\_getAllReferences().

71  {
72  foreach (ilObjDataCollection::_getAllReferences($table->getObjId()) as $reference) {
73  if ($reference == $ref_id) {
74  return true;
75  }
76  }
77  return false;
78  }
static _getAllReferences($a_id)
if(empty($password)) $table
Definition: pwgen.php:24
+ Here is the call graph for this function:

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