ILIAS  release_8 Revision v8.23
class.ilObjOrgUnitAccess.php
Go to the documentation of this file.
1 <?php
18 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
19 
26 {
37  public static function _getCommands(): array
38  {
39  $commands = [
40  [
41  'permission' => 'read',
42  'cmd' => 'view',
43  'lang_var' => 'show',
44  'default' => true,
45  ],
46  ];
47 
48  return $commands;
49  }
50 
51  public static function _checkAccessStaff(int $ref_id): bool
52  {
53  global $DIC;
54 
55  return ($DIC->access()->checkAccess('write', '', $ref_id)
56  || $DIC->access()->checkAccess('view_learning_progress', '', $ref_id))
57  && $DIC->access()->checkAccess('read', '', $ref_id);
58  }
59 
60  public static function _checkAccessSettings(int $ref_id): bool
61  {
62  global $DIC;
63 
64  return $DIC->access()->checkAccess('write', '', $ref_id);
65  }
66 
67  public static function _checkAccessExport(int $ref_id): bool
68  {
69  global $DIC;
70 
71  return $DIC->access()->checkAccess('write', '', $ref_id);
72  }
73 
74  public static function _checkAccessTypes(int $ref_id): bool
75  {
76  global $DIC;
77 
78  return $DIC->access()->checkAccess('write', '', $ref_id);
79  }
80 
81  public static function _checkAccessPositions(int $ref_id): bool
82  {
83  global $DIC;
84 
85  return $DIC->access()->checkAccess('write', '', $ref_id);
86  }
87 
88  public static function _checkAccessStaffRec(int $ref_id): bool
89  {
90  global $DIC;
91 
92  return ($DIC->access()->checkAccess('write', '', $ref_id)
93  || $DIC->access()->checkAccess('view_learning_progress_rec', '', $ref_id))
94  && $DIC->access()->checkAccess('read', '', $ref_id);
95  }
96 
97  public static function _checkAccessAdministrateUsers(int $ref_id): bool
98  {
99  global $DIC;
100 
101  return ilUserAccountSettings::getInstance()->isLocalUserAdministrationEnabled()
102  && $DIC->access()->checkAccess('cat_administrate_users', '', $ref_id);
103  }
104 
105  public static function _checkAccessToUserLearningProgress(int $ref_id, int $usr_id): bool
106  {
107  global $DIC;
108 
109  //Permission to view the Learning Progress of an OrgUnit: Employees
110  if ($DIC->access()->checkAccess('view_learning_progress', '', $ref_id)
111  && in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getEmployees($ref_id, false))
112  ) {
113  return true;
114  }
115  //Permission to view the Learning Progress of an OrgUnit: Superiors
116  if ($DIC->access()->checkAccess('view_learning_progress', '', $ref_id)
117  && in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getSuperiors($ref_id, false))
118  ) {
119  return true;
120  }
121 
122  //Permission to view the Learning Progress of an OrgUnit or SubOrgUnit!: Employees
123  if ($DIC->access()->checkAccess('view_learning_progress_rec', '', $ref_id)
124  && in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getEmployees($ref_id, true))
125  ) {
126  return true;
127  }
128 
129  //Permission to view the Learning Progress of an OrgUnit or SubOrgUnit!: Superiors
130  if ($DIC->access()->checkAccess('view_learning_progress_rec', '', $ref_id)
131  && in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getSuperiors($ref_id, true))
132  ) {
133  return true;
134  }
135 
136  return false;
137  }
138 
139 
140  public static function _checkGoto(string $a_target): bool
141  {
142  global $DIC;
143 
144  $t_arr = explode('_', $a_target);
145  if ($t_arr[0] !== 'orgu' || ((int) $t_arr[1]) <= 0) {
146  return false;
147  }
148  if ($DIC->access()->checkAccess('read', '', $t_arr[1])) {
149  return true;
150  }
151 
152  return false;
153  }
154 }
static _checkAccessStaffRec(int $ref_id)
static _checkAccessSettings(int $ref_id)
static _checkAccessExport(int $ref_id)
static _checkAccessAdministrateUsers(int $ref_id)
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
static _getCommands()
get commands this method returns an array of all possible commands/permission combinations example: $...
static _checkAccessTypes(int $ref_id)
static _checkAccessStaff(int $ref_id)
static _checkAccessToUserLearningProgress(int $ref_id, int $usr_id)
static _checkAccessPositions(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _checkGoto(string $a_target)