ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilObjContentObjectAccess Class Reference

Class ilObjContentObjectAccess. More...

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 _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 _getLastAccessedPage ($a_ref_id, $a_user_id="")
 get last accessed page More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 
- 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 Public Attributes

static $lo_access
 

Protected Attributes

 $user
 
 $lng
 
 $rbacsystem
 
 $access
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjContentObjectAccess::__construct ( )

Constructor.

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

References $DIC, and user().

44  {
45  global $DIC;
46 
47  $this->user = $DIC->user();
48  $this->lng = $DIC->language();
49  $this->rbacsystem = $DIC->rbac()->system();
50  $this->access = $DIC->access();
51  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
+ Here is the call graph for this function:

Member Function Documentation

◆ _checkAccess()

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

References $access, $ilUser, $lng, $rbacsystem, $user, IL_STATUS_MESSAGE, and ilObject\lookupOfflineStatus().

68  {
70  $lng = $this->lng;
72  $ilAccess = $this->access;
73 
74  if ($a_user_id == "") {
75  $a_user_id = $ilUser->getId();
76  }
77 
78  switch ($a_cmd) {
79  case "continue":
80 
81  // continue is now default and works all the time
82  // see ilLMPresentationGUI::resume()
83  /*
84  if ($ilUser->getId() == ANONYMOUS_USER_ID)
85  {
86  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("lm_no_continue_for_anonym"));
87  return false;
88  }
89  if (ilObjContentObjectAccess::_getLastAccessedPage($a_ref_id,$a_user_id) <= 0)
90  {
91  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("not_accessed_yet"));
92  return false;
93  }
94  */
95  break;
96 
97  // for permission query feature
98  case "info":
99  if (!ilObject::lookupOfflineStatus($a_obj_id)) {
100  $ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("online"));
101  }
102  break;
103 
104  }
105 
106  return true;
107  }
const IL_STATUS_MESSAGE
static lookupOfflineStatus($a_obj_id)
Lookup offline status using objectDataCache.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjContentObjectAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

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

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

159  {
160  global $DIC;
161 
162  $ilAccess = $DIC->access();
163 
164  $t_arr = explode("_", $a_target);
165 
166  if (($t_arr[0] != "lm" && $t_arr[0] != "st"
167  && $t_arr[0] != "pg")
168  || ((int) $t_arr[1]) <= 0) {
169  return false;
170  }
171 
172  if ($t_arr[0] == "lm") {
173  if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
174  $ilAccess->checkAccess("visible", "", $t_arr[1])) {
175  return true;
176  }
177  } else {
178  if ($t_arr[2] > 0) {
179  $ref_ids = array($t_arr[2]);
180  } else {
181  // determine learning object
182  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
183  $lm_id = ilLMObject::_lookupContObjID($t_arr[1]);
184  $ref_ids = ilObject::_getAllReferences($lm_id);
185  }
186  // check read permissions
187  foreach ($ref_ids as $ref_id) {
188  // Permission check
189  if ($ilAccess->checkAccess("read", "", $ref_id)) {
190  return true;
191  }
192  }
193  }
194  return false;
195  }
global $DIC
Definition: saml.php:7
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static _getAllReferences($a_id)
get all reference ids of object
+ Here is the call graph for this function:

◆ _getLastAccessedPage()

static ilObjContentObjectAccess::_getLastAccessedPage (   $a_ref_id,
  $a_user_id = "" 
)
static

get last accessed page

Parameters
int$a_obj_idcontent object id
int$a_user_iduser object id

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

References $DIC, $ilDB, $ilUser, and ilObject\_lookupObjId().

Referenced by ilLMPresentationGUI\resume().

121  {
122  global $DIC;
123 
124  $ilDB = $DIC->database();
125  $ilUser = $DIC->user();
126 
127  if ($a_user_id == "") {
128  $a_user_id = $ilUser->getId();
129  }
130 
131  if (isset(self::$lo_access[$a_ref_id])) {
132  $acc_rec["obj_id"] = self::$lo_access[$a_ref_id];
133  } else {
134  $q = "SELECT * FROM lo_access WHERE " .
135  "usr_id = " . $ilDB->quote($a_user_id, "integer") . " AND " .
136  "lm_id = " . $ilDB->quote($a_ref_id, "integer");
137 
138  $acc_set = $ilDB->query($q);
139  $acc_rec = $ilDB->fetchAssoc($acc_set);
140  }
141 
142  if ($acc_rec["obj_id"] > 0) {
143  $lm_id = ilObject::_lookupObjId($a_ref_id);
144  $mtree = new ilTree($lm_id);
145  $mtree->setTableNames('lm_tree', 'lm_data');
146  $mtree->setTreeTablePK("lm_id");
147  if ($mtree->isInTree($acc_rec["obj_id"])) {
148  return $acc_rec["obj_id"];
149  }
150  }
151 
152  return 0;
153  }
global $DIC
Definition: saml.php:7
static _lookupObjId($a_id)
$ilUser
Definition: imgupload.php:18
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _preloadData()

static ilObjContentObjectAccess::_preloadData (   $a_obj_ids,
  $a_ref_ids 
)
static

Preload data.

Parameters
array$a_obj_idsarray of object ids

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

References $DIC, $ilDB, $ilUser, and $r.

203  {
204  global $DIC;
205 
206  $ilDB = $DIC->database();
207  $ilUser = $DIC->user();
208 
209  $q = "SELECT obj_id, lm_id FROM lo_access WHERE " .
210  "usr_id = " . $ilDB->quote($ilUser->getId(), "integer") . " AND " .
211  $ilDB->in("lm_id", $a_ref_ids, false, "integer");
212  ;
213  $set = $ilDB->query($q);
214  foreach ($a_ref_ids as $r) {
215  self::$lo_access[$r] = 0;
216  }
217  while ($rec = $ilDB->fetchAssoc($set)) {
218  self::$lo_access[$rec["lm_id"]] = $rec["obj_id"];
219  }
220  }
global $DIC
Definition: saml.php:7
$r
Definition: example_031.php:79
$ilUser
Definition: imgupload.php:18
global $ilDB

Field Documentation

◆ $access

ilObjContentObjectAccess::$access
protected

◆ $lng

ilObjContentObjectAccess::$lng
protected

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

Referenced by _checkAccess().

◆ $lo_access

ilObjContentObjectAccess::$lo_access
static

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

◆ $rbacsystem

ilObjContentObjectAccess::$rbacsystem
protected

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

Referenced by _checkAccess().

◆ $user

ilObjContentObjectAccess::$user
protected

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

Referenced by _checkAccess().


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