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