ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 

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. 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 94 of file class.ilObjDataCollectionAccess.php.

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

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 46 of file class.ilObjDataCollectionAccess.php.

47 {
48 global $DIC;
49 $ilAccess = $DIC['ilAccess'];
50
51 $t_arr = explode("_", $a_target);
52
53 if ($t_arr[0] != "dcl" || ((int) $t_arr[1]) <= 0) {
54 return false;
55 }
56
57 if ($ilAccess->checkAccess("read", "", $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 31 of file class.ilObjDataCollectionAccess.php.

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

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 148 of file class.ilObjDataCollectionAccess.php.

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

References $DIC, and $ilDB.

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

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

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

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

References $action, and 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 382 of file class.ilObjDataCollectionAccess.php.

383 {
384 return self::hasAccessToFields($ref_id, $table_id);
385 }
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 395 of file class.ilObjDataCollectionAccess.php.

396 {
398 return in_array($field_id, $table->getFieldIds()) && self::hasAccessToFields($ref_id, $table_id);
399 }
static getTableCache($table_id=0)
if(empty($password)) $table
Definition: pwgen.php:24

References $table, 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 369 of file class.ilObjDataCollectionAccess.php.

370 {
372 && (self::hasWriteAccess($ref_id));
373 }
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 330 of file class.ilObjDataCollectionAccess.php.

331 {
333 return $table->getIsVisible() || ($table_id == $table->getCollectionObject()->getFirstVisibleTableId());
334 }

References $table, and 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 301 of file class.ilObjDataCollectionAccess.php.

302 {
303 global $DIC;
304 $rbacreview = $DIC['rbacreview'];
305 $ilUser = $DIC['ilUser'];
306 if (!$tableview) {
307 return false;
308 }
309
310
311 if (is_numeric($tableview)) {
312 $tableview = ilDclTableView::find($tableview);
313 }
314
315 $assigned_roles = $rbacreview->assignedRoles($user_id ? $user_id : $ilUser->getId());
316 $allowed_roles = $tableview->getRoles();
317
318 return !empty(array_intersect($assigned_roles, $allowed_roles));
319 }

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 266 of file class.ilObjDataCollectionAccess.php.

267 {
268 global $DIC;
269 $ilAccess = $DIC['ilAccess'];
270
271 if ($user_id) {
272 return $ilAccess->checkAccessOfUser($user_id, "write", "", $ref);
273 }
274 return $ilAccess->checkAccess("add_entry", "", $ref);
275 }

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 249 of file class.ilObjDataCollectionAccess.php.

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

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 407 of file class.ilObjDataCollectionAccess.php.

408 {
410 if (!self::isTableInDataCollection($table, $ref_id)) {
411 return false;
412 }
413
415 || (ilObjDataCollectionAccess::hasAddRecordAccess($ref_id) && $table->getAddPerm() && $table->checkLimit());
416 }

References $table, 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 283 of file class.ilObjDataCollectionAccess.php.

284 {
285 global $DIC;
286 $ilAccess = $DIC['ilAccess'];
287
288 if ($user_id) {
289 return $ilAccess->checkAccessOfUser($user_id, "write", "", $ref);
290 }
291 return $ilAccess->checkAccess("read", "", $ref);
292 }

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 230 of file class.ilObjDataCollectionAccess.php.

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

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 return false;
79 }

References $table, and 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: