ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilObjMediaObjectAccess Class Reference

Class ilObjMediaObjectAccess. More...

+ Inheritance diagram for ilObjMediaObjectAccess:
+ Collaboration diagram for ilObjMediaObjectAccess:

Public Member Functions

 canBeDelivered (ilWACPath $ilWACPath)
 

Protected Member Functions

 checkAccessMob ($obj_id)
 
 checkAccessObject ($obj_id, $obj_type='')
 Check access rights for an object by its object id. More...
 
 checkAccessTestQuestion ($obj_id, $usage_id=0)
 Check access rights for a test question This checks also tests with random selection of questions. More...
 
 checkAccessGlossaryTerm ($obj_id, $page_id)
 Check access rights for glossary terms This checks also learning modules linking the term. More...
 
 checkAccessPortfolioPage ($obj_id, $page_id)
 Check access rights for portfolio pages. More...
 
 checkAccessBlogPage ($obj_id)
 Check access rights for blog pages. More...
 
 checkAccessLearningObjectivePage ($obj_id, $page_id)
 

Detailed Description

Class ilObjMediaObjectAccess.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0

Definition at line 11 of file class.ilObjMediaObjectAccess.php.

Member Function Documentation

◆ canBeDelivered()

ilObjMediaObjectAccess::canBeDelivered ( ilWACPath  $ilWACPath)
Parameters
ilWACPath$ilWACPath
Returns
bool

Implements ilWACCheckingClass.

Definition at line 18 of file class.ilObjMediaObjectAccess.php.

References checkAccessMob(), and ilWACPath\getPath().

18  {
19  preg_match("/.\\/data\\/.*\\/mm_([0-9]*)\\/.*/ui", $ilWACPath->getPath(), $matches);
20  $obj_id = $matches[1];
21 
22  return $this->checkAccessMob($obj_id);
23  }
+ Here is the call graph for this function:

◆ checkAccessBlogPage()

ilObjMediaObjectAccess::checkAccessBlogPage (   $obj_id)
protected

Check access rights for blog pages.

Parameters
intobject id (glossary)
intpage id (definition)
Returns
boolean access given (true/false)

Definition at line 310 of file class.ilObjMediaObjectAccess.php.

References $ilUser, and checkAccessObject().

Referenced by checkAccessMob().

310  {
311  global $ilUser;
312  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
313  $tree = new ilWorkspaceTree(0);
314  $node_id = $tree->lookupNodeId($obj_id);
315  if (! $node_id) {
316  return $this->checkAccessObject($obj_id);
317  } else {
318  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
319 
320  $access_handler = new ilWorkspaceAccessHandler($tree);
321  if ($access_handler->checkAccessOfUser($tree, $ilUser->getId(), "read", "view", $node_id, "blog")) {
322  return true;
323  }
324  }
325 
326  return false;
327  }
Access handler for personal workspace.
checkAccessObject($obj_id, $obj_type='')
Check access rights for an object by its object id.
Tree handler for personal workspace.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAccessGlossaryTerm()

ilObjMediaObjectAccess::checkAccessGlossaryTerm (   $obj_id,
  $page_id 
)
protected

Check access rights for glossary terms This checks also learning modules linking the term.

Parameters
intobject id (glossary)
intpage id (definition)
Returns
boolean access given (true/false)

Definition at line 238 of file class.ilObjMediaObjectAccess.php.

References ilInternalLink\_getSourcesOfTarget(), ilLMObject\_lookupContObjID(), ilGlossaryDefinition\_lookupTermId(), and checkAccessObject().

Referenced by checkAccessMob().

238  {
239  // give access if glossary is readable
240  if ($this->checkAccessObject($obj_id)) {
241  return true;
242  }
243 
244  include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
245  include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
246  $term_id = ilGlossaryDefinition::_lookupTermId($page_id);
247 
248  include_once('./Services/Link/classes/class.ilInternalLink.php');
249  $sources = ilInternalLink::_getSourcesOfTarget('git', $term_id, 0);
250 
251  if ($sources) {
252  foreach ($sources as $src) {
253  switch ($src['type']) {
254  // Give access if term is linked by a learning module with read access.
255  // The term including media is shown by the learning module presentation!
256  case 'lm:pg':
257  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
258  $src_obj_id = ilLMObject::_lookupContObjID($src['id']);
259  if ($this->checkAccessObject($src_obj_id, 'lm')) {
260  return true;
261  }
262  break;
263 
264  // Don't yet give access if the term is linked by another glossary
265  // The link will lead to the origin glossary which is already checked
266  /*
267  case 'gdf:pg':
268  $src_term_id = ilGlossaryDefinition::_lookupTermId($src['id']);
269  $src_obj_id = ilGlossaryTerm::_lookGlossaryID($src_term_id);
270  if ($this->checkAccessObject($src_obj_id, 'glo'))
271  {
272  return true;
273  }
274  break;
275  */
276  }
277  }
278  }
279  }
checkAccessObject($obj_id, $obj_type='')
Check access rights for an object by its object id.
_lookupContObjID($a_id)
get learning module / digibook id for lm object
_lookupTermId($a_def_id)
Looks up term id for a definition id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAccessLearningObjectivePage()

ilObjMediaObjectAccess::checkAccessLearningObjectivePage (   $obj_id,
  $page_id 
)
protected
Parameters
$obj_id
$page_id
Returns
bool

Definition at line 336 of file class.ilObjMediaObjectAccess.php.

References ilCourseObjective\_lookupContainerIdByObjectiveId(), and checkAccessObject().

Referenced by checkAccessMob().

336  {
337  include_once "Modules/Course/classes/class.ilCourseObjective.php";
339 
340  return $this->checkAccessObject($crs_obj_id, 'crs');
341  }
static _lookupContainerIdByObjectiveId($a_objective_id)
Get container of object.
checkAccessObject($obj_id, $obj_type='')
Check access rights for an object by its object id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAccessMob()

ilObjMediaObjectAccess::checkAccessMob (   $obj_id)
protected
Parameters
$obj_id
Returns
bool

Definition at line 31 of file class.ilObjMediaObjectAccess.php.

References $ilUser, ilObjMediaCastAccess\_lookupPublicFiles(), ilNewsItem\_lookupVisibility(), checkAccessBlogPage(), checkAccessGlossaryTerm(), checkAccessLearningObjectivePage(), checkAccessObject(), checkAccessPortfolioPage(), checkAccessTestQuestion(), ilObjMediaObject\getParentObjectIdForUsage(), ilImprint\isActive(), ilMediaPoolPage\lookupUsages(), ilObjMediaObject\lookupUsages(), and NEWS_PUBLIC.

Referenced by canBeDelivered().

31  {
32  foreach (ilObjMediaObject::lookupUsages($obj_id) as $usage) {
34 
35  // for content snippets we must get their usages and check them
36  switch ($usage["type"]) {
37  case "auth:pg":
38  // Mobs on the Loginpage should always be delivered
39  return true;
40  case "mep:pg":
41  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
42  $usages2 = ilMediaPoolPage::lookupUsages($usage["id"]);
43  foreach ($usages2 as $usage2) {
44  $oid2 = ilObjMediaObject::getParentObjectIdForUsage($usage2, true);
45  if ($this->checkAccessMobUsage($usage2, $oid2)) {
46  return true;
47  }
48  }
49  break;
50 
51  default:
52  if ($this->checkAccessMobUsage($usage, $oid)) {
53  return true;
54  }
55  break;
56  }
57  }
58 
59  return false;
60  }
lookupUsages($a_id, $a_incl_hist=true)
Lookup usages of media object.
lookupUsages($a_id, $a_include_history=true)
Lookup usages of media object.
getParentObjectIdForUsage($a_usage, $a_include_all_access_obj_ids=false)
Get's the repository object ID of a parent object, if possible.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAccessObject()

ilObjMediaObjectAccess::checkAccessObject (   $obj_id,
  $obj_type = '' 
)
protected

Check access rights for an object by its object id.

Parameters
intobject id
Returns
boolean access given (true/false)

Definition at line 174 of file class.ilObjMediaObjectAccess.php.

References $ilUser, $ref_id, ilObject\_getAllReferences(), and ilObject\_lookupType().

Referenced by checkAccessBlogPage(), checkAccessGlossaryTerm(), checkAccessLearningObjectivePage(), checkAccessMob(), and checkAccessTestQuestion().

174  {
175  global $ilAccess, $ilUser;
176  $user_id = $ilUser->getId();
177 
178  if (! $obj_type) {
179  $obj_type = ilObject::_lookupType($obj_id);
180  }
181  $ref_ids = ilObject::_getAllReferences($obj_id);
182 
183  foreach ($ref_ids as $ref_id) {
184  // foreach ($this->check_users as $user_id) {
185  if ($ilAccess->checkAccessOfUser($user_id, "read", "view", $ref_id, $obj_type, $obj_id)) {
186  return true;
187  }
188  // }
189  }
190 
191  return false;
192  }
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilUser
Definition: imgupload.php:15
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAccessPortfolioPage()

ilObjMediaObjectAccess::checkAccessPortfolioPage (   $obj_id,
  $page_id 
)
protected

Check access rights for portfolio pages.

Parameters
intobject id (glossary)
intpage id (definition)
Returns
boolean access given (true/false)

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

References $ilUser.

Referenced by checkAccessMob().

290  {
291  global $ilUser;
292  include_once "Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php";
293  $access_handler = new ilPortfolioAccessHandler();
294  if ($access_handler->checkAccessOfUser($ilUser->getId(), "read", "view", $obj_id, "prtf")) {
295  return true;
296  }
297 
298  return false;
299  }
global $ilUser
Definition: imgupload.php:15
Access handler for portfolio.
+ Here is the caller graph for this function:

◆ checkAccessTestQuestion()

ilObjMediaObjectAccess::checkAccessTestQuestion (   $obj_id,
  $usage_id = 0 
)
protected

Check access rights for a test question This checks also tests with random selection of questions.

Parameters
intobject id (question pool or test)
intusage id (not yet used)
Returns
boolean access given (true/false)

Definition at line 204 of file class.ilObjMediaObjectAccess.php.

References $tests, ilObjTestAccess\_getRandomTestsForQuestionPool(), ilObject\_lookupType(), and checkAccessObject().

Referenced by checkAccessMob().

204  {
205  global $ilAccess;
206 
207  // give access if direct usage is readable
208  if ($this->checkAccessObject($obj_id)) {
209  return true;
210  }
211 
212  $obj_type = ilObject::_lookupType($obj_id);
213  if ($obj_type == 'qpl') {
214  // give access if question pool is used by readable test
215  // for random selection of questions
216  include_once('./Modules/Test/classes/class.ilObjTestAccess.php');
218  foreach ($tests as $test_id) {
219  if ($this->checkAccessObject($test_id, 'tst')) {
220  return true;
221  }
222  }
223  }
224 
225  return false;
226  }
checkAccessObject($obj_id, $obj_type='')
Check access rights for an object by its object id.
_getRandomTestsForQuestionPool($qpl_id)
Get all tests using a question pool for random selection.
static _lookupType($a_id, $a_reference=false)
lookup object type
+ 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: