ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjContentObjectAccess Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilObjContentObjectAccess:
+ Collaboration diagram for ilObjContentObjectAccess:

Public Member Functions

 __construct ()
 
 _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 _getLastAccessedPage (int $a_ref_id, int $a_user_id=0)
 
static _checkGoto (string $target)
 check whether goto script will succeed More...
 
static _preloadData (array $obj_ids, array $ref_ids)
 Preload data. More...
 
static isInfoEnabled (int $obj_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 Public Attributes

static array $lo_access
 

Protected Attributes

ilObjUser $user
 
ilLanguage $lng
 
ilRbacSystem $rbacsystem
 
ilAccessHandler $access
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 22 of file class.ilObjContentObjectAccess.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjContentObjectAccess::__construct ( )

Reimplemented in ilObjLearningModuleAccess.

Definition at line 29 of file class.ilObjContentObjectAccess.php.

30 {
31 global $DIC;
32
33 $this->user = $DIC->user();
34 $this->lng = $DIC->language();
35 $this->rbacsystem = $DIC->rbac()->system();
36 $this->access = $DIC->access();
37 }
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _checkAccess()

ilObjContentObjectAccess::_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 41 of file class.ilObjContentObjectAccess.php.

41 : bool
42 {
43 $ilUser = $this->user;
45 $ilAccess = $this->access;
46
47 switch ($cmd) {
48 case "continue":
49
50 // continue is now default and works all the time
51 // see ilLMPresentationGUI::resume()
52 /*
53 if ($ilUser->getId() == ANONYMOUS_USER_ID)
54 {
55 $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("lm_no_continue_for_anonym"));
56 return false;
57 }
58 if (ilObjContentObjectAccess::_getLastAccessedPage($ref_id,$user_id) <= 0)
59 {
60 $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("not_accessed_yet"));
61 return false;
62 }
63 */
64 break;
65
66 // for permission query feature
67 case "info":
68 if (!ilObject::lookupOfflineStatus($obj_id)) {
70 }
71 break;
72 }
73
74 return true;
75 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static lookupOfflineStatus(int $obj_id)
Lookup offline status using objectDataCache.
addInfoItem(string $a_type, string $a_text, string $a_data="")
add an info item to current info object

References $access, $lng, $user, ilRBACAccessHandler\addInfoItem(), ilAccessInfo\IL_STATUS_MESSAGE, ilObject\lookupOfflineStatus(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjContentObjectAccess::_checkGoto ( string  $target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

Definition at line 118 of file class.ilObjContentObjectAccess.php.

118 : bool
119 {
120 global $DIC;
121
122 $ilAccess = $DIC->access();
123
124 $t_arr = explode("_", $target);
125
126 if (($t_arr[0] != "lm" && $t_arr[0] != "st"
127 && $t_arr[0] != "pg")
128 || ((int) $t_arr[1]) <= 0) {
129 return false;
130 }
131
132 if ($t_arr[0] == "lm") {
133 if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
134 $ilAccess->checkAccess("visible", "", $t_arr[1])) {
135 return true;
136 }
137 } else {
138 if (($t_arr[2] ?? 0) > 0) {
139 $ref_ids = array($t_arr[2]);
140 } else {
141 // determine learning object
142 $lm_id = ilLMObject::_lookupContObjID($t_arr[1]);
143 $ref_ids = ilObject::_getAllReferences($lm_id);
144 }
145 // check read permissions
146 foreach ($ref_ids as $ref_id) {
147 // Permission check
148 if ($ilAccess->checkAccess("read", "", $ref_id)) {
149 return true;
150 }
151 }
152 }
153 return false;
154 }
static _lookupContObjID(int $a_id)
get learning module id for lm object
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:66

References $DIC, $ref_id, ilObject\_getAllReferences(), and ilLMObject\_lookupContObjID().

+ Here is the call graph for this function:

◆ _getLastAccessedPage()

static ilObjContentObjectAccess::_getLastAccessedPage ( int  $a_ref_id,
int  $a_user_id = 0 
)
static

Definition at line 81 of file class.ilObjContentObjectAccess.php.

84 : int {
85 global $DIC;
86
87 $ilDB = $DIC->database();
88 $ilUser = $DIC->user();
89
90 if ($a_user_id == 0) {
91 $a_user_id = $ilUser->getId();
92 }
93
94 if (isset(self::$lo_access[$a_ref_id])) {
95 $acc_rec["obj_id"] = self::$lo_access[$a_ref_id];
96 } else {
97 $q = "SELECT * FROM lo_access WHERE " .
98 "usr_id = " . $ilDB->quote($a_user_id, "integer") . " AND " .
99 "lm_id = " . $ilDB->quote($a_ref_id, "integer");
100
101 $acc_set = $ilDB->query($q);
102 $acc_rec = $ilDB->fetchAssoc($acc_set);
103 }
104
105 if (($acc_rec["obj_id"] ?? 0) > 0) {
106 $lm_id = ilObject::_lookupObjId($a_ref_id);
107 $mtree = new ilTree($lm_id);
108 $mtree->setTableNames('lm_tree', 'lm_data');
109 $mtree->setTreeTablePK("lm_id");
110 if ($mtree->isInTree($acc_rec["obj_id"])) {
111 return $acc_rec["obj_id"];
112 }
113 }
114
115 return 0;
116 }
static _lookupObjId(int $ref_id)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
$q
Definition: shib_logout.php:23

Referenced by ilLMNavigationStatus\determineStatus().

+ Here is the caller graph for this function:

◆ _preloadData()

static ilObjContentObjectAccess::_preloadData ( array  $obj_ids,
array  $ref_ids 
)
static

Preload data.

Reimplemented from ilObjectAccess.

Definition at line 156 of file class.ilObjContentObjectAccess.php.

156 : void
157 {
158 global $DIC;
159
160 $reading_time_manager = new \ILIAS\LearningModule\ReadingTime\ReadingTimeManager();
161 $reading_time_manager->loadData($obj_ids);
162
163 $ilDB = $DIC->database();
164 $ilUser = $DIC->user();
165
166 $q = "SELECT obj_id, lm_id FROM lo_access WHERE " .
167 "usr_id = " . $ilDB->quote($ilUser->getId(), "integer") . " AND " .
168 $ilDB->in("lm_id", $ref_ids, false, "integer");
169 $set = $ilDB->query($q);
170 foreach ($ref_ids as $r) {
171 self::$lo_access[$r] = 0;
172 }
173 while ($rec = $ilDB->fetchAssoc($set)) {
174 self::$lo_access[$rec["lm_id"]] = $rec["obj_id"];
175 }
176 }

References $DIC, $ilDB, and $q.

◆ isInfoEnabled()

static ilObjContentObjectAccess::isInfoEnabled ( int  $obj_id)
static

Definition at line 178 of file class.ilObjContentObjectAccess.php.

178 : bool
179 {
181 $obj_id,
183 true
184 );
185 }
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)

References ilContainer\_lookupContainerSetting(), and ilObjectServiceSettingsGUI\INFO_TAB_VISIBILITY.

Referenced by ilObjLearningModuleListGUI\getInfoScreenStatus(), ilObjFileBasedLM\isInfoEnabled(), and ilObjContentObject\isInfoEnabled().

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

Field Documentation

◆ $access

ilAccessHandler ilObjContentObjectAccess::$access
protected

Definition at line 27 of file class.ilObjContentObjectAccess.php.

Referenced by _checkAccess().

◆ $lng

ilLanguage ilObjContentObjectAccess::$lng
protected

Definition at line 25 of file class.ilObjContentObjectAccess.php.

Referenced by _checkAccess().

◆ $lo_access

array ilObjContentObjectAccess::$lo_access
static

Definition at line 39 of file class.ilObjContentObjectAccess.php.

◆ $rbacsystem

ilRbacSystem ilObjContentObjectAccess::$rbacsystem
protected

Definition at line 26 of file class.ilObjContentObjectAccess.php.

◆ $user

ilObjUser ilObjContentObjectAccess::$user
protected

Definition at line 24 of file class.ilObjContentObjectAccess.php.

Referenced by _checkAccess().


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