ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjDataCollectionAccess Class Reference
+ Inheritance diagram for ilObjDataCollectionAccess:
+ Collaboration diagram for ilObjDataCollectionAccess:

Public Member Functions

 _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::checkAccess) More...
 
- Public Member Functions inherited from ilObjectAccess
 _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::checkAccess) More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getCommands ()
 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"), ); More...
 
static _checkGoto (string $target)
 check whether goto script will succeed More...
 
static _lookupOnline (int $a_id)
 Check wether datacollection is online. More...
 
static checkAccessForDataCollectionId (int $data_collection_id)
 
static checkActionForObjId (string $action, int $obj_id)
 
static hasWriteAccess (int $ref, ?int $user_id=0)
 
static hasEditAccess (int $ref, ?int $user_id=0)
 
static hasAddRecordAccess (int $ref, ?int $user_id=0)
 
static hasReadAccess (int $ref, ?int $user_id=0)
 
static hasAccessToTableView (ilDclTableView $tableview, ?int $user_id=0)
 
static hasAccessToFields (int $ref_id, int $table_id)
 
static hasAccessToEditTable (int $ref_id, int $table_id)
 
static hasAccessToField (int $ref_id, int $table_id, int $field_id)
 
static hasPermissionToAddRecord (int $ref_id, int $table_id)
 
- Static Public Member Functions inherited from ilObjectAccess
static _getCommands ()
 get commands More...
 
static _checkGoto (string $target)
 check whether goto script will succeed More...
 
static _isOffline (int $obj_id)
 Type-specific implementation of general status, has to be overwritten if object type does not support centralized offline handling. More...
 
static _preloadData (array $obj_ids, array $ref_ids)
 Preload data. More...
 

Static Protected Member Functions

static isTableInDataCollection (ilDclTable $table, int $ref_id)
 
static hasAccessToTable (int $table_id, int $ref_id)
 

Detailed Description

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

Member Function Documentation

◆ _checkAccess()

ilObjDataCollectionAccess::_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::checkAccess)

Please do not check any preconditions handled by ilConditionHandler here. Also don't do any RBAC checks.

Reimplemented from ilObjectAccess.

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

80 : bool
81 {
82 global $DIC;
83 $ilUser = $DIC['ilUser'];
84 $lng = $DIC['lng'];
85 $rbacsystem = $DIC['rbacsystem'];
86 $ilAccess = $DIC['ilAccess'];
87
88 if (is_null($user_id) === true) {
89 $user_id = $ilUser->getId();
90 }
91
92 switch ($cmd) {
93 case "view":
94
96 && !$rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id)
97 ) {
98 $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
99
100 return false;
101 }
102 break;
103
104 // for permission query feature
105 case "infoScreen":
107 $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
108 } else {
109 $ilAccess->addInfoItem(ilAccessInfo::IL_STATUS_MESSAGE, $lng->txt("online"));
110 }
111 break;
112 }
113 switch ($permission) {
114 case "read":
115 case "visible":
117 && (!$rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id))
118 ) {
119 $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
120
121 return false;
122 }
123 break;
124 }
125
126 return true;
127 }
static _lookupOnline(int $a_id)
Check wether datacollection is online.
$ref_id
Definition: ltiauth.php:66
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26

References $DIC, $lng, $ref_id, $user_id, _lookupOnline(), ilAccessInfo\IL_NO_OBJECT_ACCESS, and ilAccessInfo\IL_STATUS_MESSAGE.

+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjDataCollectionAccess::_checkGoto ( string  $target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

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

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

References $DIC, $ref_id, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ _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 33 of file class.ilObjDataCollectionAccess.php.

33 : array
34 {
35 $commands = [
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"],
39 ];
40
41 return $commands;
42 }

Referenced by ilObjDataCollectionListGUI\init().

+ Here is the caller graph for this function:

◆ _lookupOnline()

static ilObjDataCollectionAccess::_lookupOnline ( int  $a_id)
static

Check wether datacollection is online.

Parameters
int$a_idwiki id

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

133 : bool
134 {
135 global $DIC;
136 $ilDB = $DIC->database();
137
138 $q = "SELECT * FROM il_dcl_data WHERE id = " . $ilDB->quote($a_id, "integer");
139 $dcl_set = $ilDB->query($q);
140 $dcl_rec = $ilDB->fetchAssoc($dcl_set);
141
142 return !is_null($dcl_rec) && $dcl_rec["is_online"];
143 }
$q
Definition: shib_logout.php:23

References $DIC, $ilDB, and $q.

Referenced by _checkAccess(), ilObjDataCollectionListGUI\getProperties(), and ILIAS\Container\Content\Filter\FilterManager\legacyOnlineFilter().

+ Here is the caller graph for this function:

◆ checkAccessForDataCollectionId()

static ilObjDataCollectionAccess::checkAccessForDataCollectionId ( int  $data_collection_id)
static
Parameters
$data_collection_id@depracated use checkActionForId instead
Returns
bool

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

154 : bool
155 {
156 global $DIC;
157 $ilAccess = $DIC['ilAccess'];
158
159 $perm = false;
160 $references = ilObject2::_getAllReferences($data_collection_id);
161
162 if ($ilAccess->checkAccess("add_entry", "", array_shift($references))) {
163 $perm = true;
164 }
165
166 return $perm;
167 }
static _getAllReferences(int $id)
get all reference ids for object ID

References $DIC, and ilObject\_getAllReferences().

+ Here is the call graph for this function:

◆ checkActionForObjId()

static ilObjDataCollectionAccess::checkActionForObjId ( string  $action,
int  $obj_id 
)
static

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

169 : bool
170 {
171 foreach (ilObject2::_getAllReferences($obj_id) as $ref_id) {
172 if (self::checkActionForRefId($action, $ref_id)) {
173 return true;
174 }
175 }
176
177 return false;
178 }

References $ref_id, and ilObject\_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 ( int  $ref_id,
int  $table_id 
)
static

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

296 : bool
297 {
298 return self::hasAccessToFields($ref_id, $table_id);
299 }
static hasAccessToFields(int $ref_id, int $table_id)

References $ref_id, and hasAccessToFields().

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

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

◆ hasAccessToField()

static ilObjDataCollectionAccess::hasAccessToField ( int  $ref_id,
int  $table_id,
int  $field_id 
)
static

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

301 : bool
302 {
303 $table = ilDclCache::getTableCache($table_id);
304
305 return in_array($field_id, $table->getFieldIds()) && self::hasAccessToFields($ref_id, $table_id);
306 }
static getTableCache(?int $table_id=null)

References $ref_id, 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 ( int  $ref_id,
int  $table_id 
)
static

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

290 : bool
291 {
294 }
static hasWriteAccess(int $ref, ?int $user_id=0)
static isTableInDataCollection(ilDclTable $table, int $ref_id)

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

Referenced by ilDclFieldEditGUI\checkAccess(), ilDclFieldListTableGUI\fillRowFromObject(), hasAccessToEditTable(), hasAccessToField(), and ilDclRecordListGUI\listRecords().

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

◆ hasAccessToTable()

static ilObjDataCollectionAccess::hasAccessToTable ( int  $table_id,
int  $ref_id 
)
staticprotected

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

264 : bool
265 {
266 $table = ilDclCache::getTableCache($table_id);
267 return self::hasWriteAccess($ref_id) || $table->getIsVisible();
268 }

References $ref_id, ilDclCache\getTableCache(), and hasWriteAccess().

+ Here is the call graph for this function:

◆ hasAccessToTableView()

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

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

252 : bool
253 {
254 if ($tableview->getRoleLimitation()) {
255 global $DIC;
256 $assigned_roles = $DIC->rbac()->review()->assignedRoles($user_id ?: $DIC->user()->getId());
257 $allowed_roles = $tableview->getRoles();
258
259 return array_intersect($assigned_roles, $allowed_roles) !== [];
260 }
261 return true;
262 }

References $DIC, $user_id, ilDclTableView\getRoleLimitation(), and ilDclTableView\getRoles().

Referenced by ilDclTable\getVisibleTableViews().

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

◆ hasAddRecordAccess()

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

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

224 : bool
225 {
226 global $DIC;
227 $ilAccess = $DIC['ilAccess'];
228
229 if ($user_id) {
230 return $ilAccess->checkAccessOfUser($user_id, "write", "", $ref);
231 }
232
233 return $ilAccess->checkAccess("add_entry", "", $ref);
234 }

References $DIC, and $user_id.

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

+ Here is the caller graph for this function:

◆ hasEditAccess()

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

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

208 : bool
209 {
210 global $DIC;
211 $ilAccess = $DIC['ilAccess'];
212
213 if ($user_id) {
214 return $ilAccess->checkAccessOfUser($user_id, "write", "", $ref);
215 }
216
217 return $ilAccess->checkAccess("edit_content", "", $ref);
218 }

References $DIC, and $user_id.

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

+ Here is the caller graph for this function:

◆ hasPermissionToAddRecord()

static ilObjDataCollectionAccess::hasPermissionToAddRecord ( int  $ref_id,
int  $table_id 
)
static

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

308 : bool
309 {
310 $table = ilDclCache::getTableCache($table_id);
311 if (!self::isTableInDataCollection($table, $ref_id)) {
312 return false;
313 }
314
316 || (ilObjDataCollectionAccess::hasAddRecordAccess($ref_id) && $table->getAddPerm() && $table->checkLimit());
317 }
static hasAddRecordAccess(int $ref, ?int $user_id=0)

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

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

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

◆ hasReadAccess()

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

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

240 : bool
241 {
242 global $DIC;
243 $ilAccess = $DIC['ilAccess'];
244
245 if ($user_id) {
246 return $ilAccess->checkAccessOfUser($user_id, "write", "", $ref);
247 }
248
249 return $ilAccess->checkAccess("read", "", $ref);
250 }

References $DIC, and $user_id.

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

+ Here is the caller graph for this function:

◆ hasWriteAccess()

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

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

196 : bool
197 {
198 global $DIC;
199 $ilAccess = $DIC['ilAccess'];
200
201 if ($user_id) {
202 return $ilAccess->checkAccessOfUser($user_id, "write", "", $ref);
203 }
204
205 return $ilAccess->checkAccess("write", "", $ref);
206 }

References $DIC, and $user_id.

Referenced by ilDclTableEditGUI\checkAccess(), ilDclTableListGUI\checkAccess(), ilDclRecordListGUI\createSwitchers(), ilDclDetailedViewGUI\doExtReplace(), ilDclTable\getVisibleTableViews(), hasAccessToFields(), hasAccessToTable(), hasPermissionToAddRecord(), ilDclTable\hasPermissionToDeleteRecord(), ilDclTable\hasPermissionToDeleteRecords(), ilDclTable\hasPermissionToEditRecord(), ilDclTable\hasPermissionToViewRecord(), ilDclRecordEditGUI\initForm(), ilDclRecordEditGUI\save(), and ilObjDataCollectionGUI\setTableId().

+ Here is the caller graph for this function:

◆ isTableInDataCollection()

static ilObjDataCollectionAccess::isTableInDataCollection ( ilDclTable  $table,
int  $ref_id 
)
staticprotected

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

67 : bool
68 {
69 if ($table->getObjId() !== null) {
70 foreach (ilObjDataCollection::_getAllReferences($table->getObjId()) as $reference) {
71 if ($reference == $ref_id) {
72 return true;
73 }
74 }
75 }
76
77 return false;
78 }

References $ref_id, ilObject\_getAllReferences(), and ilDclTable\getObjId().

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: