ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ILIAS\MyStaff\ilMyStaffAccess Class Reference

Class ilMyStaffAccess. More...

+ Inheritance diagram for ILIAS\MyStaff\ilMyStaffAccess:
+ Collaboration diagram for ILIAS\MyStaff\ilMyStaffAccess:

Public Member Functions

 hasCurrentUserAccessToMyStaff ()
 
 hasCurrentUserAccessToCertificates ()
 
 hasCurrentUserAccessToCompetences ()
 
 hasCurrentUserAccessToUser ($usr_id=0)
 
 hasCurrentUserAccessToLearningProgressInObject ($ref_id=0)
 
 hasCurrentUserAccessToCourseLearningProgressForAtLeastOneUser ()
 
 countOrgusOfUserWithAtLeastOneOperation ($user_id)
 
 getUsersForUserOperationAndContext ( $user_id, $org_unit_operation_string=self::DEFAULT_ORG_UNIT_OPERATION, $context=self::DEFAULT_CONTEXT, $tmp_table_name_prefix=self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_USER_MATRIX)
 
 getUsersForUserPerPosition ($user_id)
 
 getUsersForUser ($user_id, ?int $position_id=null)
 
 getIdsForUserAndOperation (int $user_id, string $operation, bool $return_ref_id=false)
 
 getIdsForPositionAndOperation (int $position_id, string $operation, bool $return_ref_id)
 
 getIdsForPositionAndOperationAndContext (int $position_id, string $operation, string $context, bool $return_ref_id)
 returns all obj_ids/ref_ids (depending on flag "ref_id") of objects of type $context, to which the position with $position_id has permissions on the operation with $operation_id More...
 
 hasPositionDefaultPermissionForOperationInContext (int $position_id, int $operation_id, int $context_id)
 
 buildTempTableCourseMemberships ($temporary_table_name_prefix=self::TMP_DEFAULT_TABLE_NAME_PREFIX_CRS_MEMBERS, array $only_courses_of_user_ids=array())
 
 buildTempTableOrguMemberships ($temporary_table_name_prefix=self::TMP_DEFAULT_TABLE_NAME_PREFIX_ORGU_MEMBERS, array $only_orgus_of_user_ids=array())
 
 dropTempTable ($temporary_table_name)
 
- 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 getInstance ()
 
- 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...
 

Data Fields

const TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_SPEC_PERMISSIONS = 'tmp_obj_spec_perm'
 
const TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_DEFAULT_PERMISSIONS = 'tmp_obj_def_perm'
 
const TMP_DEFAULT_TABLE_NAME_PREFIX_IL_ORGU_DEFAULT_PERMISSIONS = 'tmp_orgu_def_perm'
 
const TMP_DEFAULT_TABLE_NAME_PREFIX_CRS_MEMBERS = 'tmp_crs_members'
 
const TMP_DEFAULT_TABLE_NAME_PREFIX_ORGU_MEMBERS = 'tmp_orgu_members'
 
const TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_USER_MATRIX = 'tmp_obj_user_matr'
 
const DEFAULT_ORG_UNIT_OPERATION = ilOrgUnitOperation::OP_ACCESS_ENROLMENTS
 
const DEFAULT_CONTEXT = 'crs'
 

Static Protected Attributes

static $instance = null
 
static $orgu_users_of_current_user_show_staff_permission
 

Private Member Functions

 __construct ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MyStaff\ilMyStaffAccess::__construct ( )
private

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

68  {
69  }

Member Function Documentation

◆ buildTempTableCourseMemberships()

ILIAS\MyStaff\ilMyStaffAccess::buildTempTableCourseMemberships (   $temporary_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_CRS_MEMBERS,
array  $only_courses_of_user_ids = array() 
)
Parameters
string$temporary_table_name_prefix
array$only_courses_of_user_ids
Returns
string

Definition at line 829 of file class.ilMyStaffAccess.php.

References $DIC, and ILIAS\MyStaff\ilMyStaffAccess\dropTempTable().

Referenced by ILIAS\MyStaff\ilMyStaffAccess\hasPositionDefaultPermissionForOperationInContext().

830  {
831  global $DIC;
832 
833  $temporary_table_name = $temporary_table_name_prefix . "_user_id_" . $DIC->user()->getId();
834 
835  if ($temporary_table_name != self::TMP_DEFAULT_TABLE_NAME_PREFIX_CRS_MEMBERS . "_user_id_" . $DIC->user()->getId()
836  || count($only_courses_of_user_ids) > 0
837  ) {
838  $this->dropTempTable($temporary_table_name);
839  }
840 
841  $q = "CREATE TEMPORARY TABLE IF NOT EXISTS " . $temporary_table_name . "
842  (INDEX i1(ref_id), INDEX i2 (usr_id), INDEX i3 (position_id), INDEX i4 (orgu_id))
843  AS (
844  SELECT crs_members_crs_ref.ref_id, crs_members.usr_id, orgu_ua.position_id, orgu_ua.orgu_id
845  FROM (
846  SELECT obj_id, usr_id FROM obj_members WHERE member = 1
847  AND " . $DIC->database()->in('obj_members.usr_id', $only_courses_of_user_ids, false, 'integer') . "
848  UNION
849  SELECT obj_id, usr_id FROM crs_waiting_list
850  WHERE " . $DIC->database()->in('crs_waiting_list.usr_id', $only_courses_of_user_ids, false, 'integer') . "
851  UNION
852  SELECT obj_id, usr_id FROM il_subscribers
853  WHERE " . $DIC->database()->in('il_subscribers.usr_id', $only_courses_of_user_ids, false, 'integer') . "
854  ) AS crs_members
855  INNER JOIN object_reference AS crs_members_crs_ref on crs_members_crs_ref.obj_id = crs_members.obj_id
856  INNER JOIN il_orgu_ua AS orgu_ua on orgu_ua.user_id = crs_members.usr_id
857  );";
858 
859  $DIC->database()->manipulate($q);
860 
861  return $temporary_table_name;
862  }
$DIC
Definition: xapitoken.php:46
dropTempTable($temporary_table_name)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTempTableOrguMemberships()

ILIAS\MyStaff\ilMyStaffAccess::buildTempTableOrguMemberships (   $temporary_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_ORGU_MEMBERS,
array  $only_orgus_of_user_ids = array() 
)
Parameters
string$temporary_table_name_prefix
array$only_orgus_of_user_ids
Returns
string

Definition at line 871 of file class.ilMyStaffAccess.php.

References $DIC, and ILIAS\MyStaff\ilMyStaffAccess\dropTempTable().

Referenced by ILIAS\MyStaff\ilMyStaffAccess\getUsersForUser(), and ILIAS\MyStaff\ilMyStaffAccess\hasPositionDefaultPermissionForOperationInContext().

872  {
873  global $DIC;
874 
875  $temporary_table_name = $temporary_table_name_prefix . "_user_id_" . $DIC->user()->getId();
876 
877  if ($temporary_table_name != self::TMP_DEFAULT_TABLE_NAME_PREFIX_ORGU_MEMBERS . "_user_id_" . $DIC->user()->getId()
878  || count($only_orgus_of_user_ids) > 0
879  ) {
880  $this->dropTempTable($temporary_table_name);
881  }
882 
883  $q = "CREATE TEMPORARY TABLE IF NOT EXISTS " . $temporary_table_name . "
884  (INDEX i1(orgu_id), INDEX i2 (tree_path), INDEX i3 (tree_child), INDEX i4 (tree_parent), INDEX i5 (tree_lft), INDEX i6 (tree_rgt), INDEX i7 (user_position_id), INDEX i8 (user_id))
885  AS (
886  SELECT orgu_ua.orgu_id AS orgu_id,
887  tree_orgu.path AS tree_path,
888  tree_orgu.child AS tree_child,
889  tree_orgu.parent AS tree_parent,
890  tree_orgu.lft AS tree_lft,
891  tree_orgu.rgt AS tree_rgt,
892  orgu_ua.position_id AS user_position_id,
893  orgu_ua.user_id AS user_id
894  FROM
895  il_orgu_ua AS orgu_ua
896  INNER JOIN object_reference AS obj_ref on obj_ref.ref_id = orgu_ua.orgu_id AND obj_ref.deleted is null
897  LEFT JOIN tree AS tree_orgu ON tree_orgu.child = orgu_ua.orgu_id";
898 
899  if (count($only_orgus_of_user_ids) > 0) {
900  $q .= " WHERE " . $DIC->database()->in('orgu_ua.user_id', $only_orgus_of_user_ids, false, 'integer') . " ";
901  }
902 
903  $q .= ");";
904 
905  $DIC->database()->manipulate($q);
906 
907  return $temporary_table_name;
908  }
$DIC
Definition: xapitoken.php:46
dropTempTable($temporary_table_name)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ countOrgusOfUserWithAtLeastOneOperation()

ILIAS\MyStaff\ilMyStaffAccess::countOrgusOfUserWithAtLeastOneOperation (   $user_id)
Parameters
int$user_id
Returns
int

Definition at line 208 of file class.ilMyStaffAccess.php.

References $context, $DIC, and ilOrgUnitOperationQueries\findByOperationString().

209  {
210  global $DIC;
211 
212  $q = "SELECT COUNT(orgu_ua.orgu_id) AS 'cnt' FROM il_orgu_permissions AS perm
213  INNER JOIN il_orgu_ua AS orgu_ua ON orgu_ua.position_id = perm.position_id
214  INNER JOIN il_orgu_op_contexts AS contexts on contexts.id = perm.context_id AND contexts.context is not NULL
215  WHERE orgu_ua.user_id = " . $DIC->database()->quote($user_id, 'integer') . " AND perm.operations is not NULL AND perm.parent_id = -1";
216 
217  $set = $DIC->database()->query($q);
218  $rec = $DIC->database()->fetchAssoc($set);
219 
220  return $rec['cnt'];
221  }
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ dropTempTable()

ILIAS\MyStaff\ilMyStaffAccess::dropTempTable (   $temporary_table_name)
Parameters
string$temporary_table_name
Returns
bool

Definition at line 916 of file class.ilMyStaffAccess.php.

References $DIC.

Referenced by ILIAS\MyStaff\ilMyStaffAccess\buildTempTableCourseMemberships(), ILIAS\MyStaff\ilMyStaffAccess\buildTempTableOrguMemberships(), and ILIAS\MyStaff\ilMyStaffAccess\hasPositionDefaultPermissionForOperationInContext().

917  {
918  global $DIC;
919 
920  $q = "DROP TABLE IF EXISTS " . $temporary_table_name;
921  $DIC->database()->manipulate($q);
922 
923  return true;
924  }
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ getIdsForPositionAndOperation()

ILIAS\MyStaff\ilMyStaffAccess::getIdsForPositionAndOperation ( int  $position_id,
string  $operation,
bool  $return_ref_id 
)
Parameters
int$position_id
string$operation
bool$return_ref_id
Returns
array

Definition at line 403 of file class.ilMyStaffAccess.php.

References ilOrgUnitOperationContext\$available_contexts, $context, and ILIAS\MyStaff\ilMyStaffAccess\getIdsForPositionAndOperationAndContext().

Referenced by ILIAS\MyStaff\ilMyStaffAccess\getIdsForUserAndOperation().

403  : array
404  {
405  $ids = [];
407  $ref_ids = $this->getIdsForPositionAndOperationAndContext($position_id, $operation, $context, $return_ref_id);
408  if(count($ref_ids) > 0) {
409  $ids = array_merge($ids, $ref_ids);
410  }
411  }
412 
413  return $ids;
414  }
$context
Definition: webdav.php:26
getIdsForPositionAndOperationAndContext(int $position_id, string $operation, string $context, bool $return_ref_id)
returns all obj_ids/ref_ids (depending on flag "ref_id") of objects of type $context, to which the position with $position_id has permissions on the operation with $operation_id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIdsForPositionAndOperationAndContext()

ILIAS\MyStaff\ilMyStaffAccess::getIdsForPositionAndOperationAndContext ( int  $position_id,
string  $operation,
string  $context,
bool  $return_ref_id 
)

returns all obj_ids/ref_ids (depending on flag "ref_id") of objects of type $context, to which the position with $position_id has permissions on the operation with $operation_id

Parameters
int$position_id
string$operation
string$context
bool$return_ref_id
Returns
array

Definition at line 430 of file class.ilMyStaffAccess.php.

References $DIC, $query, ilOrgUnitOperationContextQueries\findByName(), ilOrgUnitOperationQueries\findByOperationString(), and ILIAS\MyStaff\ilMyStaffAccess\hasPositionDefaultPermissionForOperationInContext().

Referenced by ILIAS\MyStaff\ilMyStaffAccess\getIdsForPositionAndOperation().

430  : array
431  {
432  global $DIC;
434  $operation_object = ilOrgUnitOperationQueries::findByOperationString($operation, $context);
435  if (is_null($operation_object)) {
436  // operation doesn't exist in this context
437  return [];
438  }
439  $operation_id = $operation_object->getOperationId();
440 
441  if ($this->hasPositionDefaultPermissionForOperationInContext($position_id, $operation_id, $context_id)) {
442  $query = 'select ' . ($return_ref_id ? 'object_reference.ref_id' : 'object_data.obj_id') . ' from object_data ' .
443  'inner join object_reference on object_reference.obj_id = object_data.obj_id ' .
444  'where type = "' . $context . '" ' .
445  'AND object_reference.ref_id not in ' .
446  ' (SELECT parent_id FROM il_orgu_permissions ' .
447  ' where position_id = ' . $position_id . ' and context_id = ' . $context_id . ' and operations not like \'%"' . $operation_id . '"%\' and parent_id <> -1)';
448  } else {
449  $query = $return_ref_id
450  ?
451  'SELECT parent_id as ref_id FROM il_orgu_permissions '
452  :
453  'SELECT obj_id FROM il_orgu_permissions INNER JOIN object_reference ON object_reference.ref_id = il_orgu_permissions.parent_id ';
454  $query .= ' where position_id = ' . $position_id . ' and context_id = ' . $context_id . ' and operations like \'%"' . $operation_id . '"%\' and parent_id <> -1';
455  }
456 
457  return array_map(function ($item) use ($return_ref_id) {
458  return $return_ref_id ? $item['ref_id'] : $item['obj_id'];
459  }, $DIC->database()->fetchAll($DIC->database()->query($query)));
460  }
$context
Definition: webdav.php:26
hasPositionDefaultPermissionForOperationInContext(int $position_id, int $operation_id, int $context_id)
$query
$DIC
Definition: xapitoken.php:46
static findByOperationString($operation_string, $context_name)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIdsForUserAndOperation()

ILIAS\MyStaff\ilMyStaffAccess::getIdsForUserAndOperation ( int  $user_id,
string  $operation,
bool  $return_ref_id = false 
)
Parameters
int$user_id
string$operation
bool$return_ref_id
Returns
int[]

Definition at line 381 of file class.ilMyStaffAccess.php.

References ILIAS\MyStaff\ilMyStaffAccess\getIdsForPositionAndOperation(), and ilOrgUnitUserAssignmentQueries\getInstance().

381  : array
382  {
383  $user_assignments = ilOrgUnitUserAssignmentQueries::getInstance()->getAssignmentsOfUserId($user_id);
384  $ids = [];
385  foreach ($user_assignments as $user_assignment) {
386  $ref_ids = $this->getIdsForPositionAndOperation($user_assignment->getPositionId(), $operation, $return_ref_id);
387  if(count($ref_ids) > 0) {
388  $ids = array_merge($ids, $ref_ids);
389  }
390  }
391 
392  return $ids;
393  }
getIdsForPositionAndOperation(int $position_id, string $operation, bool $return_ref_id)
+ Here is the call graph for this function:

◆ getInstance()

static ILIAS\MyStaff\ilMyStaffAccess::getInstance ( )
static
Returns
self

Definition at line 41 of file class.ilMyStaffAccess.php.

References $DIC.

Referenced by ILIAS\MyStaff\ListCertificates\ilMStListCertificates\__construct(), ILIAS\MyStaff\ListUsers\ilMStListUsersTableGUI\__construct(), ILIAS\MyStaff\ListCertificates\ilMStListCertificatesTableGUI\__construct(), ILIAS\MyStaff\ListCourses\ilMStListCoursesTableGUI\__construct(), ILIAS\MyStaff\ListCompetences\Skills\ilMStListCompetencesSkillsTableGUI\__construct(), ILIAS\MyStaff\Courses\ShowUser\ilMStShowUserCoursesTableGUI\__construct(), ILIAS\MyStaff\ListCourses\ilMStListCourses\getData(), ILIAS\MyStaff\Provider\StaffMainBarProvider\getStaticSubItems(), and ILIAS\MainMenu\Provider\StandardTopItemsProvider\getStaticTopItems().

42  {
43  global $DIC;
44 
45  if (self::$instance === null) {
46  self::$instance = new self();
47 
48  self::$instance->dropTempTable(self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_SPEC_PERMISSIONS . "_" . self::DEFAULT_ORG_UNIT_OPERATION . "_"
49  . self::DEFAULT_CONTEXT);
50  self::$instance->dropTempTable(self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_DEFAULT_PERMISSIONS . "_" . self::DEFAULT_ORG_UNIT_OPERATION
51  . "_" . self::DEFAULT_CONTEXT);
52  self::$instance->dropTempTable(self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_ORGU_DEFAULT_PERMISSIONS . "_" . self::DEFAULT_ORG_UNIT_OPERATION
53  . "_" . self::DEFAULT_CONTEXT);
54  self::$instance->dropTempTable(self::TMP_DEFAULT_TABLE_NAME_PREFIX_CRS_MEMBERS . "_user_id_" . $DIC->user()->getId());
55  self::$instance->dropTempTable(self::TMP_DEFAULT_TABLE_NAME_PREFIX_ORGU_MEMBERS . "_user_id_" . $DIC->user()->getId());
56  self::$instance->dropTempTable(self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_USER_MATRIX . "_" . self::DEFAULT_ORG_UNIT_OPERATION . "_"
57  . self::DEFAULT_CONTEXT);
58  }
59 
60  return self::$instance;
61  }
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ getUsersForUser()

ILIAS\MyStaff\ilMyStaffAccess::getUsersForUser (   $user_id,
?int  $position_id = null 
)
Parameters
int$user_id
int | null$position_id
Returns
int[]

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

References $DIC, and ILIAS\MyStaff\ilMyStaffAccess\buildTempTableOrguMemberships().

Referenced by ILIAS\MyStaff\ilMyStaffAccess\getUsersForUserPerPosition(), ILIAS\MyStaff\ilMyStaffAccess\hasCurrentUserAccessToUser(), and ILIAS\MyStaff\ilMyStaffAccess\hasPositionDefaultPermissionForOperationInContext().

310  : array
311  {
312  global $DIC;
313 
314  $tmp_orgu_members = $this->buildTempTableOrguMemberships(self::TMP_DEFAULT_TABLE_NAME_PREFIX_ORGU_MEMBERS, array());
315 
316  $position_limitation = '';
317  if (!is_null($position_id)) {
318  $position_limitation = ' AND orgu_ua_current_user.position_id = ' . $position_id;
319  }
320 
321  $q = "SELECT " . $tmp_orgu_members . ".user_id AS usr_id
322  FROM
323  " . $tmp_orgu_members . "
324  INNER JOIN il_orgu_ua AS orgu_ua_current_user on orgu_ua_current_user.user_id = " . $DIC->database()->quote($user_id, 'integer') . "
325  INNER JOIN il_orgu_authority AS auth ON auth.position_id = orgu_ua_current_user.position_id " . $position_limitation . "
326  WHERE
327  (
328  /* Identische OrgUnit wie Current User; Nicht Rekursiv; Fixe Position */
329  (orgu_ua_current_user.orgu_id = " . $tmp_orgu_members . ".orgu_id AND auth.scope = 1
330  AND auth.over = " . $tmp_orgu_members . ".user_position_id AND auth.over <> -1
331  )
332  OR
333  /* Identische OrgUnit wie Current User; Nicht Rekursiv; Position egal */
334  (orgu_ua_current_user.orgu_id = " . $tmp_orgu_members . ".orgu_id AND auth.scope = 1 AND auth.over = -1)
335  OR
336  /* Kinder OrgUnit wie Current User */
337  (
338  (
339  " . $tmp_orgu_members . ".orgu_id = orgu_ua_current_user.orgu_id OR
340  " . $tmp_orgu_members . ".tree_path LIKE CONCAT(\"%.\",orgu_ua_current_user.orgu_id ,\".%\")
341  OR
342  " . $tmp_orgu_members . ".tree_path LIKE CONCAT(\"%.\",orgu_ua_current_user.orgu_id )
343  )
344  AND
345  (
346  (
347  (
348  /* Gleiche Position */
349  auth.over = " . $tmp_orgu_members . ".user_position_id AND auth.over <> -1
350  )
351  OR
352  (
353  /* Position Egal */
354  auth.over = -1
355  )
356  )
357  AND auth.scope = 2
358  )
359  )
360  )";
361 
362  $user_set = $DIC->database()->query($q);
363 
364  $arr_users = array();
365 
366  while ($rec = $DIC->database()->fetchAssoc($user_set)) {
367  $arr_users[$rec['usr_id']] = $rec['usr_id'];
368  }
369 
370  return $arr_users;
371  }
$DIC
Definition: xapitoken.php:46
buildTempTableOrguMemberships($temporary_table_name_prefix=self::TMP_DEFAULT_TABLE_NAME_PREFIX_ORGU_MEMBERS, array $only_orgus_of_user_ids=array())
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUsersForUserOperationAndContext()

ILIAS\MyStaff\ilMyStaffAccess::getUsersForUserOperationAndContext (   $user_id,
  $org_unit_operation_string = self::DEFAULT_ORG_UNIT_OPERATION,
  $context = self::DEFAULT_CONTEXT,
  $tmp_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_USER_MATRIX 
)
Parameters
int$user_id
string$org_unit_operation_string
string$context
string$tmp_table_name_prefix
Returns
array

Definition at line 262 of file class.ilMyStaffAccess.php.

References $context, and $DIC.

Referenced by ILIAS\MyStaff\ilMyStaffAccess\hasCurrentUserAccessToCourseLearningProgressForAtLeastOneUser().

267  {
268  global $DIC;
269 
270  $tmp_table_name = $this->buildTempTableIlobjectsUserMatrixForUserOperationAndContext($user_id, $org_unit_operation_string, $context, $tmp_table_name_prefix);
271 
272  $q = 'SELECT usr_id FROM ' . $tmp_table_name;
273 
274  $user_set = $DIC->database()->query($q);
275 
276  $arr_users = array();
277 
278  while ($rec = $DIC->database()->fetchAssoc($user_set)) {
279  $arr_users[$rec['usr_id']] = $rec['usr_id'];
280  }
281 
282  return $arr_users;
283  }
$context
Definition: webdav.php:26
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ getUsersForUserPerPosition()

ILIAS\MyStaff\ilMyStaffAccess::getUsersForUserPerPosition (   $user_id)
Parameters
$user_id
Returns
array

Definition at line 291 of file class.ilMyStaffAccess.php.

References ilOrgUnitUserAssignmentQueries\getInstance(), and ILIAS\MyStaff\ilMyStaffAccess\getUsersForUser().

291  : array
292  {
293  $users = [];
294  $user_assignments = ilOrgUnitUserAssignmentQueries::getInstance()->getAssignmentsOfUserId($user_id);
295  foreach ($user_assignments as $user_assignment) {
296  $users[$user_assignment->getPositionId()] = $this->getUsersForUser($user_id, $user_assignment->getPositionId());
297  }
298 
299  return $users;
300  }
getUsersForUser($user_id, ?int $position_id=null)
+ Here is the call graph for this function:

◆ hasCurrentUserAccessToCertificates()

ILIAS\MyStaff\ilMyStaffAccess::hasCurrentUserAccessToCertificates ( )
Returns
bool

Definition at line 116 of file class.ilMyStaffAccess.php.

References $DIC, and ilOrgUnitOperation\OP_VIEW_CERTIFICATES.

Referenced by ILIAS\MyStaff\ilMyStaffAccess\hasCurrentUserAccessToMyStaff().

116  : bool
117  {
118  global $DIC;
119 
120  if (!$DIC->settings()->get("enable_my_staff")) {
121  return false;
122  }
123 
124  if ($this->countOrgusOfUserWithOperationAndContext($DIC->user()->getId(), ilOrgUnitOperation::OP_VIEW_CERTIFICATES, self::DEFAULT_CONTEXT)
125  > 0
126  ) {
127  return true;
128  }
129 
130  return false;
131  }
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ hasCurrentUserAccessToCompetences()

ILIAS\MyStaff\ilMyStaffAccess::hasCurrentUserAccessToCompetences ( )
Returns
bool

Definition at line 137 of file class.ilMyStaffAccess.php.

References $DIC, and ilOrgUnitOperation\OP_VIEW_COMPETENCES.

Referenced by ILIAS\MyStaff\ilMyStaffAccess\hasCurrentUserAccessToMyStaff().

137  : bool
138  {
139  global $DIC;
140 
141  if (!$DIC->settings()->get("enable_my_staff")) {
142  return false;
143  }
144 
145  if ($this->countOrgusOfUserWithOperationAndContext($DIC->user()->getId(), ilOrgUnitOperation::OP_VIEW_COMPETENCES, self::DEFAULT_CONTEXT)
146  > 0
147  ) {
148  return true;
149  }
150 
151  return false;
152  }
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ hasCurrentUserAccessToCourseLearningProgressForAtLeastOneUser()

ILIAS\MyStaff\ilMyStaffAccess::hasCurrentUserAccessToCourseLearningProgressForAtLeastOneUser ( )
Returns
bool

Definition at line 189 of file class.ilMyStaffAccess.php.

References $DIC, ILIAS\MyStaff\ilMyStaffAccess\getUsersForUserOperationAndContext(), and ilOrgUnitOperation\OP_READ_LEARNING_PROGRESS.

Referenced by ILIAS\MyStaff\ilMyStaffAccess\hasCurrentUserAccessToMyStaff().

189  : bool
190  {
191  global $DIC;
192 
193  $arr_usr_id = $this->getUsersForUserOperationAndContext($DIC->user()
194  ->getId(), ilOrgUnitOperation::OP_READ_LEARNING_PROGRESS, self::DEFAULT_CONTEXT);
195  if (count($arr_usr_id) > 0) {
196  return true;
197  }
198 
199  return false;
200  }
getUsersForUserOperationAndContext( $user_id, $org_unit_operation_string=self::DEFAULT_ORG_UNIT_OPERATION, $context=self::DEFAULT_CONTEXT, $tmp_table_name_prefix=self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_USER_MATRIX)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasCurrentUserAccessToLearningProgressInObject()

ILIAS\MyStaff\ilMyStaffAccess::hasCurrentUserAccessToLearningProgressInObject (   $ref_id = 0)
Parameters
int$ref_id
Returns
bool

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

References $DIC, and ilOrgUnitOperation\OP_READ_LEARNING_PROGRESS.

178  : bool
179  {
180  global $DIC;
181 
182  return $DIC->access()->checkPositionAccess(ilOrgUnitOperation::OP_READ_LEARNING_PROGRESS, $ref_id);
183  }
$DIC
Definition: xapitoken.php:46

◆ hasCurrentUserAccessToMyStaff()

ILIAS\MyStaff\ilMyStaffAccess::hasCurrentUserAccessToMyStaff ( )
Returns
bool

Definition at line 75 of file class.ilMyStaffAccess.php.

References $DIC, ILIAS\MyStaff\ilMyStaffAccess\hasCurrentUserAccessToCertificates(), ILIAS\MyStaff\ilMyStaffAccess\hasCurrentUserAccessToCompetences(), ILIAS\MyStaff\ilMyStaffAccess\hasCurrentUserAccessToCourseLearningProgressForAtLeastOneUser(), ILIAS\MyStaff\ilMyStaffAccess\hasCurrentUserAccessToUser(), and ilOrgUnitOperation\OP_ACCESS_ENROLMENTS.

75  : bool
76  {
77  global $DIC;
78 
79  if ($DIC->rbac()->system()->checkAccess('visible', SYSTEM_FOLDER_ID)) {
80  return true;
81  }
82 
83  if (!$DIC->settings()->get("enable_my_staff")) {
84  return false;
85  }
86 
87  if ($this->hasCurrentUserAccessToUser()) {
88  return true;
89  }
90 
91  if ($this->countOrgusOfUserWithOperationAndContext($DIC->user()->getId(), ilOrgUnitOperation::OP_ACCESS_ENROLMENTS, self::DEFAULT_CONTEXT)
92  > 0
93  ) {
94  return true;
95  }
96 
98  return true;
99  }
100 
101  if ($this->hasCurrentUserAccessToCertificates()) {
102  return true;
103  }
104 
105  if ($this->hasCurrentUserAccessToCompetences()) {
106  true;
107  }
108 
109  return false;
110  }
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ hasCurrentUserAccessToUser()

ILIAS\MyStaff\ilMyStaffAccess::hasCurrentUserAccessToUser (   $usr_id = 0)
Parameters
int$usr_id
Returns
bool

Definition at line 160 of file class.ilMyStaffAccess.php.

References $DIC, and ILIAS\MyStaff\ilMyStaffAccess\getUsersForUser().

Referenced by ILIAS\MyStaff\ilMyStaffAccess\hasCurrentUserAccessToMyStaff().

160  : bool
161  {
162  global $DIC;
163 
164  $arr_users = $this->getUsersForUser($DIC->user()->getId());
165  if (count($arr_users) > 0 && in_array($usr_id, $arr_users)) {
166  return true;
167  }
168 
169  return false;
170  }
getUsersForUser($user_id, ?int $position_id=null)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasPositionDefaultPermissionForOperationInContext()

ILIAS\MyStaff\ilMyStaffAccess::hasPositionDefaultPermissionForOperationInContext ( int  $position_id,
int  $operation_id,
int  $context_id 
)
Parameters
int$position_id
int$operation_id
int$context_id
Returns
bool

Definition at line 470 of file class.ilMyStaffAccess.php.

References $context, $DIC, $GLOBALS, $res, ILIAS\MyStaff\ilMyStaffAccess\buildTempTableCourseMemberships(), ILIAS\MyStaff\ilMyStaffAccess\buildTempTableOrguMemberships(), ILIAS\MyStaff\ilMyStaffAccess\dropTempTable(), ilOrgUnitOperationQueries\findByOperationString(), ILIAS\MyStaff\ilMyStaffAccess\getUsersForUser(), ilOrgUnitOperation\OP_ACCESS_ENROLMENTS, and user().

Referenced by ILIAS\MyStaff\ilMyStaffAccess\getIdsForPositionAndOperationAndContext().

470  : bool
471  {
472  global $DIC;
473  $res = $DIC->database()->query('SELECT * FROM il_orgu_permissions ' .
474  ' WHERE context_id = ' . $context_id . ' ' .
475  'AND operations LIKE \'%"' . $operation_id . '"%\' ' .
476  'AND position_id = ' . $position_id . ' ' .
477  'AND parent_id = -1');
478 
479  return (bool) $DIC->database()->numRows($res) > 0;
480  }
foreach($_POST as $key=> $value) $res
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $instance

ILIAS\MyStaff\ilMyStaffAccess::$instance = null
staticprotected

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

◆ $orgu_users_of_current_user_show_staff_permission

ILIAS\MyStaff\ilMyStaffAccess::$orgu_users_of_current_user_show_staff_permission
staticprotected

Definition at line 35 of file class.ilMyStaffAccess.php.

◆ DEFAULT_CONTEXT

◆ DEFAULT_ORG_UNIT_OPERATION

const ILIAS\MyStaff\ilMyStaffAccess::DEFAULT_ORG_UNIT_OPERATION = ilOrgUnitOperation::OP_ACCESS_ENROLMENTS

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

◆ TMP_DEFAULT_TABLE_NAME_PREFIX_CRS_MEMBERS

const ILIAS\MyStaff\ilMyStaffAccess::TMP_DEFAULT_TABLE_NAME_PREFIX_CRS_MEMBERS = 'tmp_crs_members'

Definition at line 23 of file class.ilMyStaffAccess.php.

◆ TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_DEFAULT_PERMISSIONS

const ILIAS\MyStaff\ilMyStaffAccess::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_DEFAULT_PERMISSIONS = 'tmp_obj_def_perm'

Definition at line 21 of file class.ilMyStaffAccess.php.

◆ TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_SPEC_PERMISSIONS

const ILIAS\MyStaff\ilMyStaffAccess::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_SPEC_PERMISSIONS = 'tmp_obj_spec_perm'

Definition at line 20 of file class.ilMyStaffAccess.php.

◆ TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_USER_MATRIX

const ILIAS\MyStaff\ilMyStaffAccess::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_USER_MATRIX = 'tmp_obj_user_matr'

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

◆ TMP_DEFAULT_TABLE_NAME_PREFIX_IL_ORGU_DEFAULT_PERMISSIONS

const ILIAS\MyStaff\ilMyStaffAccess::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_ORGU_DEFAULT_PERMISSIONS = 'tmp_orgu_def_perm'

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

◆ TMP_DEFAULT_TABLE_NAME_PREFIX_ORGU_MEMBERS

const ILIAS\MyStaff\ilMyStaffAccess::TMP_DEFAULT_TABLE_NAME_PREFIX_ORGU_MEMBERS = 'tmp_orgu_members'

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


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