ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ()
 
 hasCurrentUserAccessToCourseMemberships ()
 
 hasCurrentUserAccessToUser ($usr_id=0)
 
 hasCurrentUserAccessToLearningProgressInObject ($ref_id=0)
 
 hasCurrentUserAccessToCourseLearningProgressForAtLeastOneUser ()
 
 countOrgusOfUserWithAtLeastOneOperation ($user_id)
 
 getUsersForUserOperationAndContext ( $user_id, $org_unit_operation_string, $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 ACCESS_ENROLMENTS_ORG_UNIT_OPERATION = ilOrgUnitOperation::OP_ACCESS_ENROLMENTS
 
const COURSE_CONTEXT = ilOrgUnitOperationContext::CONTEXT_CRS
 
const EXERCISE_CONTEXT = ilOrgUnitOperationContext::CONTEXT_EXC
 
const GROUP_CONTEXT = ilOrgUnitOperationContext::CONTEXT_GRP
 
const SURVEY_CONTEXT = ilOrgUnitOperationContext::CONTEXT_SVY
 
const TEST_CONTEXT = ilOrgUnitOperationContext::CONTEXT_TST
 

Protected Attributes

 $users_for_user = []
 

Static Protected Attributes

static $instance = null
 

Private Member Functions

 __construct ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MyStaff\ilMyStaffAccess::__construct ( )
private

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

73  {
74  }

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 896 of file class.ilMyStaffAccess.php.

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

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

897  {
898  global $DIC;
899 
900  $temporary_table_name = $temporary_table_name_prefix . "_user_id_" . $DIC->user()->getId();
901 
902  if ($temporary_table_name != self::TMP_DEFAULT_TABLE_NAME_PREFIX_CRS_MEMBERS . "_user_id_" . $DIC->user()->getId()
903  || count($only_courses_of_user_ids) > 0
904  ) {
905  $this->dropTempTable($temporary_table_name);
906  }
907 
908  $q = "CREATE TEMPORARY TABLE IF NOT EXISTS " . $temporary_table_name . "
909  (INDEX i1(ref_id), INDEX i2 (usr_id), INDEX i3 (position_id), INDEX i4 (orgu_id))
910  AS (
911  SELECT crs_members_crs_ref.ref_id, crs_members.usr_id, orgu_ua.position_id, orgu_ua.orgu_id
912  FROM (
913  SELECT obj_id, usr_id FROM obj_members WHERE admin > 0 OR tutor > 0 OR member > 0
914  AND " . $DIC->database()->in('obj_members.usr_id', $only_courses_of_user_ids, false, 'integer') . "
915  UNION
916  SELECT obj_id, usr_id FROM crs_waiting_list
917  WHERE " . $DIC->database()->in('crs_waiting_list.usr_id', $only_courses_of_user_ids, false, 'integer') . "
918  UNION
919  SELECT obj_id, usr_id FROM il_subscribers
920  WHERE " . $DIC->database()->in('il_subscribers.usr_id', $only_courses_of_user_ids, false, 'integer') . "
921  ) AS crs_members
922  INNER JOIN object_reference AS crs_members_crs_ref on crs_members_crs_ref.obj_id = crs_members.obj_id
923  INNER JOIN il_orgu_ua AS orgu_ua on orgu_ua.user_id = crs_members.usr_id
924  );";
925 
926  $DIC->database()->manipulate($q);
927 
928  return $temporary_table_name;
929  }
global $DIC
Definition: goto.php:24
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 938 of file class.ilMyStaffAccess.php.

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

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

939  {
940  global $DIC;
941 
942  $temporary_table_name = $temporary_table_name_prefix . "_user_id_" . $DIC->user()->getId();
943 
944  if ($temporary_table_name != self::TMP_DEFAULT_TABLE_NAME_PREFIX_ORGU_MEMBERS . "_user_id_" . $DIC->user()->getId()
945  || count($only_orgus_of_user_ids) > 0
946  ) {
947  $this->dropTempTable($temporary_table_name);
948  }
949 
950  $q = "CREATE TEMPORARY TABLE IF NOT EXISTS " . $temporary_table_name . "
951  (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))
952  AS (
953  SELECT orgu_ua.orgu_id AS orgu_id,
954  tree_orgu.path AS tree_path,
955  tree_orgu.child AS tree_child,
956  tree_orgu.parent AS tree_parent,
957  tree_orgu.lft AS tree_lft,
958  tree_orgu.rgt AS tree_rgt,
959  orgu_ua.position_id AS user_position_id,
960  orgu_ua.user_id AS user_id
961  FROM
962  il_orgu_ua AS orgu_ua
963  INNER JOIN object_reference AS obj_ref on obj_ref.ref_id = orgu_ua.orgu_id AND obj_ref.deleted is null
964  LEFT JOIN tree AS tree_orgu ON tree_orgu.child = orgu_ua.orgu_id";
965 
966  if (count($only_orgus_of_user_ids) > 0) {
967  $q .= " WHERE " . $DIC->database()->in('orgu_ua.user_id', $only_orgus_of_user_ids, false, 'integer') . " ";
968  }
969 
970  $q .= ");";
971 
972  $DIC->database()->manipulate($q);
973 
974  return $temporary_table_name;
975  }
global $DIC
Definition: goto.php:24
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 267 of file class.ilMyStaffAccess.php.

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

268  {
269  global $DIC;
270 
271  $q = "SELECT COUNT(orgu_ua.orgu_id) AS 'cnt' FROM il_orgu_permissions AS perm
272  INNER JOIN il_orgu_ua AS orgu_ua ON orgu_ua.position_id = perm.position_id
273  INNER JOIN il_orgu_op_contexts AS contexts on contexts.id = perm.context_id AND contexts.context is not NULL
274  WHERE orgu_ua.user_id = " . $DIC->database()->quote($user_id, 'integer') . " AND perm.operations is not NULL AND perm.parent_id = -1";
275 
276  $set = $DIC->database()->query($q);
277  $rec = $DIC->database()->fetchAssoc($set);
278 
279  return $rec['cnt'];
280  }
global $DIC
Definition: goto.php:24
+ 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 983 of file class.ilMyStaffAccess.php.

References $DIC.

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

984  {
985  global $DIC;
986 
987  $q = "DROP TABLE IF EXISTS " . $temporary_table_name;
988  $DIC->database()->manipulate($q);
989 
990  return true;
991  }
global $DIC
Definition: goto.php:24
+ 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 470 of file class.ilMyStaffAccess.php.

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

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

470  : array
471  {
472  $ids = [];
474  $ref_ids = $this->getIdsForPositionAndOperationAndContext($position_id, $operation, $context, $return_ref_id);
475  if(count($ref_ids) > 0) {
476  $ids = array_merge($ids, $ref_ids);
477  }
478  }
479 
480  return $ids;
481  }
$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 497 of file class.ilMyStaffAccess.php.

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

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

497  : array
498  {
499  global $DIC;
501  $operation_object = ilOrgUnitOperationQueries::findByOperationString($operation, $context);
502  if (is_null($operation_object)) {
503  // operation doesn't exist in this context
504  return [];
505  }
506  $operation_id = $operation_object->getOperationId();
507 
508  if ($this->hasPositionDefaultPermissionForOperationInContext($position_id, $operation_id, $context_id)) {
509  $query = 'select ' . ($return_ref_id ? 'object_reference.ref_id' : 'object_data.obj_id') . ' from object_data ' .
510  'inner join object_reference on object_reference.obj_id = object_data.obj_id ' .
511  'where type = "' . $context . '" ' .
512  'AND object_reference.ref_id not in ' .
513  ' (SELECT parent_id FROM il_orgu_permissions ' .
514  ' where position_id = ' . $position_id . ' and context_id = ' . $context_id . ' and operations not like \'%"' . $operation_id . '"%\' and parent_id <> -1)';
515  } else {
516  $query = $return_ref_id
517  ?
518  'SELECT parent_id as ref_id FROM il_orgu_permissions '
519  :
520  'SELECT obj_id FROM il_orgu_permissions INNER JOIN object_reference ON object_reference.ref_id = il_orgu_permissions.parent_id ';
521  $query .= ' where position_id = ' . $position_id . ' and context_id = ' . $context_id . ' and operations like \'%"' . $operation_id . '"%\' and parent_id <> -1';
522  }
523 
524  return array_map(function ($item) use ($return_ref_id) {
525  return $return_ref_id ? $item['ref_id'] : $item['obj_id'];
526  }, $DIC->database()->fetchAll($DIC->database()->query($query)));
527  }
$context
Definition: webdav.php:26
hasPositionDefaultPermissionForOperationInContext(int $position_id, int $operation_id, int $context_id)
global $DIC
Definition: goto.php:24
$query
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 448 of file class.ilMyStaffAccess.php.

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

448  : array
449  {
450  $user_assignments = ilOrgUnitUserAssignmentQueries::getInstance()->getAssignmentsOfUserId($user_id);
451  $ids = [];
452  foreach ($user_assignments as $user_assignment) {
453  $ref_ids = $this->getIdsForPositionAndOperation($user_assignment->getPositionId(), $operation, $return_ref_id);
454  if(count($ref_ids) > 0) {
455  $ids = array_merge($ids, $ref_ids);
456  }
457  }
458 
459  return $ids;
460  }
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 46 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\Courses\ShowUser\ilMStShowUserCoursesTableGUI\__construct(), ILIAS\MyStaff\ListCourses\ilMStListCoursesTableGUI\__construct(), ILIAS\MyStaff\ListCompetences\Skills\ilMStListCompetencesSkillsTableGUI\__construct(), ILIAS\MyStaff\ListCourses\ilMStListCourses\getData(), and ILIAS\MyStaff\Provider\StaffMainBarProvider\getStaticSubItems().

47  {
48  global $DIC;
49 
50  if (self::$instance === null) {
51  self::$instance = new self();
52 
53  self::$instance->dropTempTable(self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_SPEC_PERMISSIONS . "_" . self::ACCESS_ENROLMENTS_ORG_UNIT_OPERATION . "_"
54  . self::COURSE_CONTEXT);
55  self::$instance->dropTempTable(self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_DEFAULT_PERMISSIONS . "_" . self::ACCESS_ENROLMENTS_ORG_UNIT_OPERATION
56  . "_" . self::COURSE_CONTEXT);
57  self::$instance->dropTempTable(self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_ORGU_DEFAULT_PERMISSIONS . "_" . self::ACCESS_ENROLMENTS_ORG_UNIT_OPERATION
58  . "_" . self::COURSE_CONTEXT);
59  self::$instance->dropTempTable(self::TMP_DEFAULT_TABLE_NAME_PREFIX_CRS_MEMBERS . "_user_id_" . $DIC->user()->getId());
60  self::$instance->dropTempTable(self::TMP_DEFAULT_TABLE_NAME_PREFIX_ORGU_MEMBERS . "_user_id_" . $DIC->user()->getId());
61  self::$instance->dropTempTable(self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_USER_MATRIX . "_" . self::ACCESS_ENROLMENTS_ORG_UNIT_OPERATION . "_"
62  . self::COURSE_CONTEXT);
63  }
64 
65  return self::$instance;
66  }
global $DIC
Definition: goto.php:24
+ 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 369 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().

369  : array
370  {
371  global $DIC;
372 
373  if (isset($this->users_for_user[$user_id]) && $position_id === null) {
374  return $this->users_for_user[$user_id];
375  }
376 
377  $tmp_orgu_members = $this->buildTempTableOrguMemberships(self::TMP_DEFAULT_TABLE_NAME_PREFIX_ORGU_MEMBERS, array());
378 
379  $position_limitation = '';
380  if (!is_null($position_id)) {
381  $position_limitation = ' AND orgu_ua_current_user.position_id = ' . $position_id;
382  }
383 
384  $q = "SELECT " . $tmp_orgu_members . ".user_id AS usr_id
385  FROM
386  " . $tmp_orgu_members . "
387  INNER JOIN il_orgu_ua AS orgu_ua_current_user on orgu_ua_current_user.user_id = " . $DIC->database()->quote($user_id, 'integer') . "
388  INNER JOIN il_orgu_authority AS auth ON auth.position_id = orgu_ua_current_user.position_id " . $position_limitation . "
389  WHERE
390  (
391  /* Identische OrgUnit wie Current User; Nicht Rekursiv; Fixe Position */
392  (orgu_ua_current_user.orgu_id = " . $tmp_orgu_members . ".orgu_id AND auth.scope = 1
393  AND auth.over = " . $tmp_orgu_members . ".user_position_id AND auth.over <> -1
394  )
395  OR
396  /* Identische OrgUnit wie Current User; Nicht Rekursiv; Position egal */
397  (orgu_ua_current_user.orgu_id = " . $tmp_orgu_members . ".orgu_id AND auth.scope = 1 AND auth.over = -1)
398  OR
399  /* Kinder OrgUnit wie Current User */
400  (
401  (
402  " . $tmp_orgu_members . ".orgu_id = orgu_ua_current_user.orgu_id OR
403  " . $tmp_orgu_members . ".tree_path LIKE CONCAT(\"%.\",orgu_ua_current_user.orgu_id ,\".%\")
404  OR
405  " . $tmp_orgu_members . ".tree_path LIKE CONCAT(\"%.\",orgu_ua_current_user.orgu_id )
406  )
407  AND
408  (
409  (
410  (
411  /* Gleiche Position */
412  auth.over = " . $tmp_orgu_members . ".user_position_id AND auth.over <> -1
413  )
414  OR
415  (
416  /* Position Egal */
417  auth.over = -1
418  )
419  )
420  AND auth.scope = 2
421  )
422  )
423  )";
424 
425  $user_set = $DIC->database()->query($q);
426 
427  $arr_users = array();
428 
429  while ($rec = $DIC->database()->fetchAssoc($user_set)) {
430  $arr_users[$rec['usr_id']] = $rec['usr_id'];
431  }
432 
433  if ($position_id === null) {
434  $this->users_for_user[$user_id] = $arr_users;
435  }
436 
437  return $arr_users;
438  }
global $DIC
Definition: goto.php:24
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,
  $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 321 of file class.ilMyStaffAccess.php.

References $context, and $DIC.

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

326  {
327  global $DIC;
328 
329  $tmp_table_name = $this->buildTempTableIlobjectsUserMatrixForUserOperationAndContext($user_id, $org_unit_operation_string, $context, $tmp_table_name_prefix);
330 
331  $q = 'SELECT usr_id FROM ' . $tmp_table_name;
332 
333  $user_set = $DIC->database()->query($q);
334 
335  $arr_users = array();
336 
337  while ($rec = $DIC->database()->fetchAssoc($user_set)) {
338  $arr_users[$rec['usr_id']] = $rec['usr_id'];
339  }
340 
341  return $arr_users;
342  }
$context
Definition: webdav.php:26
global $DIC
Definition: goto.php:24
+ Here is the caller graph for this function:

◆ getUsersForUserPerPosition()

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

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

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

350  : array
351  {
352  $users = [];
353  $user_assignments = ilOrgUnitUserAssignmentQueries::getInstance()->getAssignmentsOfUserId($user_id);
354  foreach ($user_assignments as $user_assignment) {
355  $users[$user_assignment->getPositionId()] = $this->getUsersForUser($user_id, $user_assignment->getPositionId());
356  }
357 
358  return $users;
359  }
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 111 of file class.ilMyStaffAccess.php.

References $DIC, and ilOrgUnitOperation\OP_VIEW_CERTIFICATES.

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

111  : bool
112  {
113  global $DIC;
114 
115  if (!$DIC->settings()->get("enable_my_staff")) {
116  return false;
117  }
118 
119  $cert_set = new \ilSetting("certificate");
120  if (!$cert_set->get("active")) {
121  return false;
122  }
123 
124  if ($this->countOrgusOfUserWithOperationAndContext($DIC->user()->getId(), ilOrgUnitOperation::OP_VIEW_CERTIFICATES, self::COURSE_CONTEXT)
125  > 0
126  ) {
127  return true;
128  }
129 
130  if ($this->countOrgusOfUserWithOperationAndContext($DIC->user()->getId(), ilOrgUnitOperation::OP_VIEW_CERTIFICATES, self::EXERCISE_CONTEXT)
131  > 0
132  ) {
133  return true;
134  }
135 
136  if ($this->countOrgusOfUserWithOperationAndContext($DIC->user()->getId(), ilOrgUnitOperation::OP_VIEW_CERTIFICATES, self::TEST_CONTEXT)
137  > 0
138  ) {
139  return true;
140  }
141 
142  return false;
143  }
global $DIC
Definition: goto.php:24
+ Here is the caller graph for this function:

◆ hasCurrentUserAccessToCompetences()

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

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

References $DIC, and ilOrgUnitOperation\OP_VIEW_COMPETENCES.

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

149  : bool
150  {
151  global $DIC;
152 
153  if (!$DIC->settings()->get("enable_my_staff")) {
154  return false;
155  }
156 
157  $skmg_set = new \ilSkillManagementSettings();
158  if (!$skmg_set->isActivated()) {
159  return false;
160  }
161 
162  if ($this->countOrgusOfUserWithOperationAndContext($DIC->user()->getId(), ilOrgUnitOperation::OP_VIEW_COMPETENCES, self::COURSE_CONTEXT)
163  > 0
164  ) {
165  return true;
166  }
167 
168  if ($this->countOrgusOfUserWithOperationAndContext($DIC->user()->getId(), ilOrgUnitOperation::OP_VIEW_COMPETENCES, self::GROUP_CONTEXT)
169  > 0
170  ) {
171  return true;
172  }
173 
174  if ($this->countOrgusOfUserWithOperationAndContext($DIC->user()->getId(), ilOrgUnitOperation::OP_VIEW_COMPETENCES, self::SURVEY_CONTEXT)
175  > 0
176  ) {
177  return true;
178  }
179 
180  if ($this->countOrgusOfUserWithOperationAndContext($DIC->user()->getId(), ilOrgUnitOperation::OP_VIEW_COMPETENCES, self::TEST_CONTEXT)
181  > 0
182  ) {
183  return true;
184  }
185 
186  return false;
187  }
global $DIC
Definition: goto.php:24
+ Here is the caller graph for this function:

◆ hasCurrentUserAccessToCourseLearningProgressForAtLeastOneUser()

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

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

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

248  : bool
249  {
250  global $DIC;
251 
252  $arr_usr_id = $this->getUsersForUserOperationAndContext($DIC->user()
253  ->getId(), ilOrgUnitOperation::OP_READ_LEARNING_PROGRESS, self::COURSE_CONTEXT);
254  if (count($arr_usr_id) > 0) {
255  return true;
256  }
257 
258  return false;
259  }
global $DIC
Definition: goto.php:24
getUsersForUserOperationAndContext( $user_id, $org_unit_operation_string, $context, $tmp_table_name_prefix=self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_USER_MATRIX)
+ Here is the call graph for this function:

◆ hasCurrentUserAccessToCourseMemberships()

ILIAS\MyStaff\ilMyStaffAccess::hasCurrentUserAccessToCourseMemberships ( )

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

References $DIC.

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

189  : bool
190  {
191  global $DIC;
192 
193  if (!$DIC->settings()->get("enable_my_staff")) {
194  return false;
195  }
196 
197  if ($this->countOrgusOfUserWithOperationAndContext($DIC->user()->getId(), self::ACCESS_ENROLMENTS_ORG_UNIT_OPERATION, self::COURSE_CONTEXT)
198  > 0
199  ) {
200  return true;
201  }
202 
203  return false;
204  }
global $DIC
Definition: goto.php:24
+ 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 237 of file class.ilMyStaffAccess.php.

References $DIC, and ilOrgUnitOperation\OP_READ_LEARNING_PROGRESS.

237  : bool
238  {
239  global $DIC;
240 
241  return $DIC->access()->checkPositionAccess(ilOrgUnitOperation::OP_READ_LEARNING_PROGRESS, $ref_id);
242  }
global $DIC
Definition: goto.php:24

◆ hasCurrentUserAccessToMyStaff()

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

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

References $DIC, ILIAS\MyStaff\ilMyStaffAccess\hasCurrentUserAccessToCertificates(), ILIAS\MyStaff\ilMyStaffAccess\hasCurrentUserAccessToCompetences(), ILIAS\MyStaff\ilMyStaffAccess\hasCurrentUserAccessToCourseMemberships(), and ILIAS\MyStaff\ilMyStaffAccess\hasCurrentUserAccessToUser().

80  : bool
81  {
82  global $DIC;
83 
84  if (!$DIC->settings()->get("enable_my_staff")) {
85  return false;
86  }
87 
89  return true;
90  }
91 
93  return true;
94  }
95 
96  if ($this->hasCurrentUserAccessToCompetences()) {
97  return true;
98  }
99 
100  if ($this->hasCurrentUserAccessToUser()) {
101  return true;
102  }
103 
104  return false;
105  }
global $DIC
Definition: goto.php:24
+ 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 211 of file class.ilMyStaffAccess.php.

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

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

211  : bool
212  {
213  global $DIC;
214 
215  if (!$DIC->settings()->get("enable_my_staff")) {
216  return false;
217  }
218 
219  $arr_users = $this->getUsersForUser($DIC->user()->getId());
220  if (count($arr_users) > 0 && $usr_id === 0) {
221  return true;
222  }
223 
224  if (count($arr_users) > 0 && in_array($usr_id, $arr_users)) {
225  return true;
226  }
227 
228  return false;
229  }
getUsersForUser($user_id, ?int $position_id=null)
global $DIC
Definition: goto.php:24
+ 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 537 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(), and user().

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

537  : bool
538  {
539  global $DIC;
540  $res = $DIC->database()->query('SELECT * FROM il_orgu_permissions ' .
541  ' WHERE context_id = ' . $context_id . ' ' .
542  'AND operations LIKE \'%"' . $operation_id . '"%\' ' .
543  'AND position_id = ' . $position_id . ' ' .
544  'AND parent_id = -1');
545 
546  return (bool) $DIC->database()->numRows($res) > 0;
547  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
+ 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 36 of file class.ilMyStaffAccess.php.

◆ $users_for_user

ILIAS\MyStaff\ilMyStaffAccess::$users_for_user = []
protected

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

◆ ACCESS_ENROLMENTS_ORG_UNIT_OPERATION

◆ COURSE_CONTEXT

◆ EXERCISE_CONTEXT

const ILIAS\MyStaff\ilMyStaffAccess::EXERCISE_CONTEXT = ilOrgUnitOperationContext::CONTEXT_EXC

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

◆ GROUP_CONTEXT

const ILIAS\MyStaff\ilMyStaffAccess::GROUP_CONTEXT = ilOrgUnitOperationContext::CONTEXT_GRP

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

◆ SURVEY_CONTEXT

const ILIAS\MyStaff\ilMyStaffAccess::SURVEY_CONTEXT = ilOrgUnitOperationContext::CONTEXT_SVY

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

◆ TEST_CONTEXT

const ILIAS\MyStaff\ilMyStaffAccess::TEST_CONTEXT = ilOrgUnitOperationContext::CONTEXT_TST

Definition at line 31 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: