ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilLearningProgressAccess Class Reference

Learning progress access checks. More...

+ Collaboration diagram for ilLearningProgressAccess:

Static Public Member Functions

static checkPermission ($a_permission, $a_ref_id, $a_user_id=null)
 wrapper for rbac access checks More...
 
static checkAccess ($a_ref_id, $a_allow_only_read=true)
 check access to learning progress More...
 

Detailed Description

Learning progress access checks.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 33 of file class.ilLearningProgressAccess.php.

Member Function Documentation

◆ checkAccess()

static ilLearningProgressAccess::checkAccess (   $a_ref_id,
  $a_allow_only_read = true 
)
static

check access to learning progress

Parameters
int$a_ref_idreference ifd of object
bool$a_allow_only_readread access is sufficient (see courses/groups)
Returns

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

References $ilUser, ilObjUserTracking\_enabledLearningProgress(), ilObjUserTracking\_hasLearningProgressLearner(), ilObject\_lookupObjId(), ilObject\_lookupType(), and ilObjectLP\getInstance().

Referenced by ilObjContentObjectGUI\addTabs(), ilLMExplorerGUI\checkLPIcon(), ilLearningProgressGUI\editManual(), ilObjSurveyGUI\getTabs(), ilObjFolderGUI\getTabs(), ilObjExerciseGUI\getTabs(), ilObjFileBasedLMGUI\getTabs(), ilObjSAHSLearningModuleGUI\getTabs(), ilObjGroupGUI\getTabs(), ilObjSessionGUI\getTabs(), ilObjCourseGUI\getTabs(), ilObjTestGUI\getTabs(), ilObjSCORMLearningModuleGUI\offlineModeManager(), ilObjContentObjectGUI\setilLMMenu(), ilSAHSPresentationGUI\setInfoTabs(), ilObjFileGUI\setTabs(), ilObjMediaCastGUI\setTabs(), and ilLearningProgressGUI\updateManual().

68  {
69  global $ilUser,$ilAccess;
70 
71  if($ilUser->getId() == ANONYMOUS_USER_ID)
72  {
73  return false;
74  }
75 
76  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
78  {
79  return false;
80  }
81 
82  // workaround for missing file object permissions
83  if(ilObject::_lookupType($a_ref_id, true) == 'file' &&
84  $ilAccess->checkAccess('write','',$a_ref_id)
85  )
86  {
87  return true;
88  }
89 
90  if($ilAccess->checkAccess('read_learning_progress','',$a_ref_id) ||
91  $ilAccess->checkAccess('edit_learning_progress','',$a_ref_id))
92  {
93  return true;
94  }
95 
97  {
98  return false;
99  }
100 
101  include_once './Services/Object/classes/class.ilObjectLP.php';
103  if(!$olp->isActive())
104  {
105  return false;
106  }
107 
108  if(!$ilAccess->checkAccess('read','',$a_ref_id))
109  {
110  return false;
111  }
112 
113  if($a_allow_only_read)
114  {
115  return true;
116  }
117 
118  return false;
119  }
static _enabledLearningProgress()
check wether learing progress is enabled or not
static _lookupObjId($a_id)
$ilUser
Definition: imgupload.php:18
static _lookupType($a_id, $a_reference=false)
lookup object type
static getInstance($a_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkPermission()

static ilLearningProgressAccess::checkPermission (   $a_permission,
  $a_ref_id,
  $a_user_id = null 
)
static

wrapper for rbac access checks

Definition at line 38 of file class.ilLearningProgressAccess.php.

References $GLOBALS, and ilObject\_lookupType().

Referenced by ilTrObjectUsersPropsTableGUI\__construct(), ilLearningProgressGUI\__getNextClass(), ilLearningProgressBaseGUI\__setSubTabs(), ilLPListOfObjectsGUI\editUser(), ilLearningProgressGUI\executeCommand(), ilLPCollectionSettingsTableGUI\fillRow(), ilTrUserObjectsPropsTableGUI\fillRow(), ilTrUserObjectsPropsTableGUI\getItems(), ilTrSummaryTableGUI\getItems(), ilTrMatrixTableGUI\getSelectableColumns(), ilLPListOfProgressGUI\show(), and ilLPListOfObjectsGUI\updateUser().

39  {
40  if(is_null($a_user_id))
41  {
42  $a_user_id = $GLOBALS['ilUser']->getId();
43  }
44 
45  // workaround for missing permission definitions in file object
46  $type = ilObject::_lookupType($a_ref_id, true);
47  if(
48  $type == 'file' && (
49  $a_permission == 'read_learning_progress' ||
50  $a_permission == 'edit_learning_progress'
51  )
52  ) {
53  return $GLOBALS['ilAccess']->checkAccessOfUser($a_user_id, 'write','', $a_ref_id);
54  }
55  return $GLOBALS['ilAccess']->checkAccessOfUser($a_user_id, $a_permission,'', $a_ref_id);
56  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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: