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

Class ilObjMediaObjectAccess. More...

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 
 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)
 

Protected Attributes

 $obj_data_cache
 
 $user
 
 $access
 

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.

Constructor & Destructor Documentation

◆ __construct()

ilObjMediaObjectAccess::__construct ( )

Constructor.

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

33 {
34 global $DIC;
35
36 $this->obj_data_cache = $DIC["ilObjDataCache"];
37 $this->user = $DIC->user();
38 $this->access = $DIC->access();
39 }
user()
Definition: user.php:4
global $DIC
Definition: saml.php:7

References $DIC, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ canBeDelivered()

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

Implements ilWACCheckingClass.

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

48 {
49 preg_match("/.\\/data\\/.*\\/mm_([0-9]*)\\/.*/ui", $ilWACPath->getPath(), $matches);
50 $obj_id = $matches[1];
51
52 return $this->checkAccessMob($obj_id);
53 }

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

+ 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 366 of file class.ilObjMediaObjectAccess.php.

367 {
369 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
370 $tree = new ilWorkspaceTree(0);
371 $node_id = $tree->lookupNodeId($obj_id);
372 if (!$node_id) {
373 return $this->checkAccessObject($obj_id);
374 } else {
375 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
376
377 $access_handler = new ilWorkspaceAccessHandler($tree);
378 if ($access_handler->checkAccessOfUser($tree, $ilUser->getId(), "read", "view", $node_id, "blog")) {
379 return true;
380 }
381 }
382
383 return false;
384 }
checkAccessObject($obj_id, $obj_type='')
Check access rights for an object by its object id.
Access handler for personal workspace.
Tree handler for personal workspace.
$ilUser
Definition: imgupload.php:18

References $ilUser, $tree, $user, and checkAccessObject().

+ Here is the call 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 292 of file class.ilObjMediaObjectAccess.php.

293 {
294 // give access if glossary is readable
295 if ($this->checkAccessObject($obj_id)) {
296 return true;
297 }
298
299 include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
300 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
301 $term_id = ilGlossaryDefinition::_lookupTermId($page_id);
302
303 include_once('./Services/Link/classes/class.ilInternalLink.php');
304 $sources = ilInternalLink::_getSourcesOfTarget('git', $term_id, 0);
305
306 if ($sources) {
307 foreach ($sources as $src) {
308 switch ($src['type']) {
309 // Give access if term is linked by a learning module with read access.
310 // The term including media is shown by the learning module presentation!
311 case 'lm:pg':
312 include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
313 $src_obj_id = ilLMObject::_lookupContObjID($src['id']);
314 if ($this->checkAccessObject($src_obj_id, 'lm')) {
315 return true;
316 }
317 break;
318
319 // Don't yet give access if the term is linked by another glossary
320 // The link will lead to the origin glossary which is already checked
321 /*
322 case 'gdf:pg':
323 $src_term_id = ilGlossaryDefinition::_lookupTermId($src['id']);
324 $src_obj_id = ilGlossaryTerm::_lookGlossaryID($src_term_id);
325 if ($this->checkAccessObject($src_obj_id, 'glo'))
326 {
327 return true;
328 }
329 break;
330 */
331 }
332 }
333 }
334 }
static _lookupTermId($a_def_id)
Looks up term id for a definition id.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object

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

+ Here is the call graph for this function:

◆ checkAccessLearningObjectivePage()

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

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

394 {
395 include_once "Modules/Course/classes/class.ilCourseObjective.php";
397
398 return $this->checkAccessObject($crs_obj_id, 'crs');
399 }
static _lookupContainerIdByObjectiveId($a_objective_id)
Get container of object.

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

+ Here is the call graph for this function:

◆ checkAccessMob()

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

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

62 {
63 foreach (ilObjMediaObject::lookupUsages($obj_id) as $usage) {
65
66 // for content snippets we must get their usages and check them
67 switch ($usage["type"]) {
68 case "auth:pg":
69 // Mobs on the Loginpage should always be delivered
70 return true;
71 case "mep:pg":
72 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
73 $usages2 = ilMediaPoolPage::lookupUsages($usage["id"]);
74 foreach ($usages2 as $usage2) {
76 if ($this->checkAccessMobUsage($usage2, $oid2)) {
77 return true;
78 }
79 }
80 break;
81
82 default:
83 if ($this->checkAccessMobUsage($usage, $oid)) {
84 return true;
85 }
86 break;
87 }
88 }
89
90 return false;
91 }
static lookupUsages($a_id, $a_incl_hist=true)
Lookup usages of media object.
static getParentObjectIdForUsage($a_usage, $a_include_all_access_obj_ids=false)
Get's the repository object ID of a parent object, if possible.
static lookupUsages($a_id, $a_include_history=true)
Lookup usages of media object.

References ilObjMediaObject\getParentObjectIdForUsage(), ilMediaPoolPage\lookupUsages(), and ilObjMediaObject\lookupUsages().

Referenced by canBeDelivered().

+ 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 225 of file class.ilObjMediaObjectAccess.php.

226 {
227 $ilAccess = $this->access;
229 $user_id = $ilUser->getId();
230
231 if (!$obj_type) {
232 $obj_type = ilObject::_lookupType($obj_id);
233 }
234 $ref_ids = ilObject::_getAllReferences($obj_id);
235
236 foreach ($ref_ids as $ref_id) {
237 // foreach ($this->check_users as $user_id) {
238 if ($ilAccess->checkAccessOfUser($user_id, "read", "view", $ref_id, $obj_type, $obj_id)) {
239 return true;
240 }
241 // }
242 }
243
244 return false;
245 }
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type

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

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

+ 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 345 of file class.ilObjMediaObjectAccess.php.

346 {
348 include_once "Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php";
349 $access_handler = new ilPortfolioAccessHandler();
350 if ($access_handler->checkAccessOfUser($ilUser->getId(), "read", "view", $obj_id, "prtf")) {
351 return true;
352 }
353
354 return false;
355 }
Access handler for portfolio.

References $ilUser, and $user.

◆ 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 257 of file class.ilObjMediaObjectAccess.php.

258 {
259 $ilAccess = $this->access;
260
261 // give access if direct usage is readable
262 if ($this->checkAccessObject($obj_id)) {
263 return true;
264 }
265
266 $obj_type = ilObject::_lookupType($obj_id);
267 if ($obj_type == 'qpl') {
268 // give access if question pool is used by readable test
269 // for random selection of questions
270 include_once('./Modules/Test/classes/class.ilObjTestAccess.php');
272 foreach ($tests as $test_id) {
273 if ($this->checkAccessObject($test_id, 'tst')) {
274 return true;
275 }
276 }
277 }
278
279 return false;
280 }
static _getRandomTestsForQuestionPool($qpl_id)
Get all tests using a question pool for random selection.
$tests
Definition: bench.php:104

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

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilObjMediaObjectAccess::$access
protected

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

Referenced by checkAccessObject(), and checkAccessTestQuestion().

◆ $obj_data_cache

ilObjMediaObjectAccess::$obj_data_cache
protected

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

◆ $user

ilObjMediaObjectAccess::$user
protected

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