ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjOrgUnitAccess.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
11{
12
25 public static function _getCommands()
26 {
27 $commands = array();
28 $commands[] = array( 'permission' => 'read', 'cmd' => 'view', 'lang_var' => 'show', 'default' => true );
29 // $commands[] = array('permission' => 'read', 'cmd' => 'render', 'lang_var' => 'show', 'default' => true);
30 // $commands[] = array('permission' => 'write', 'cmd' => 'enableAdministrationPanel', 'lang_var' => 'edit_content');
31 // $commands[] = array( 'permission' => 'write', 'cmd' => 'edit', 'lang_var' => 'settings' );
32
33 return $commands;
34 }
35
36
42 public static function _checkAccessStaff($ref_id)
43 {
44 global $DIC;
45 $ilAccess = $DIC['ilAccess'];
46
47 if (($ilAccess->checkAccess("write", "", $ref_id)
48 or $ilAccess->checkAccess("view_learning_progress", "", $ref_id))
49 and $ilAccess->checkAccess("read", "", $ref_id)) {
50 return true;
51 }
52
53 return false;
54 }
55
61 public static function _checkAccessStaffRec($ref_id)
62 {
63 global $DIC;
64 $ilAccess = $DIC['ilAccess'];
65
66 if (($ilAccess->checkAccess("write", "", $ref_id)
67 or $ilAccess->checkAccess("view_learning_progress_rec", "", $ref_id))
68 and $ilAccess->checkAccess("read", "", $ref_id)) {
69 return true;
70 }
71
72 return false;
73 }
74
80 public static function _checkAccessAdministrateUsers($ref_id)
81 {
82 global $DIC;
83 $ilAccess = $DIC['ilAccess'];
84
85 if (ilUserAccountSettings::getInstance()->isLocalUserAdministrationEnabled() and
86 $ilAccess->checkAccess('cat_administrate_users', "", $ref_id)) {
87 return true;
88 }
89
90 return false;
91 }
92
98 public static function _checkAccessExport($ref_id)
99 {
100 global $DIC;
101 $ilAccess = $DIC['ilAccess'];
102
103 if ($ilAccess->checkAccess('write', '', $ref_id)) {
104 return true;
105 }
106
107 return false;
108 }
109
116 public static function _checkAccessToUserLearningProgress($ref_id, $usr_id)
117 {
118 global $DIC;
119 $ilAccess = $DIC['ilAccess'];
120
121 //Permission to view the Learning Progress of an OrgUnit: Employees
122 if ($ilAccess->checkAccess("view_learning_progress", "", $ref_id)
123 and in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getEmployees($ref_id, false))) {
124 return true;
125 }
126 //Permission to view the Learning Progress of an OrgUnit: Superiors
127 if ($ilAccess->checkAccess("view_learning_progress", "", $ref_id)
128 and in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getSuperiors($ref_id, false))) {
129 return true;
130 }
131
132 //Permission to view the Learning Progress of an OrgUnit or SubOrgUnit!: Employees
133 if ($ilAccess->checkAccess("view_learning_progress_rec", "", $ref_id)
134 and in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getEmployees($ref_id, true))) {
135 return true;
136 }
137
138 //Permission to view the Learning Progress of an OrgUnit or SubOrgUnit!: Superiors
139 if ($ilAccess->checkAccess("view_learning_progress_rec", "", $ref_id)
140 and in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getSuperiors($ref_id, true))) {
141 return true;
142 }
143
144 return false;
145 }
146
147
151 public static function _checkGoto($a_target)
152 {
153 global $DIC;
154 $ilAccess = $DIC['ilAccess'];
155 $t_arr = explode('_', $a_target);
156 if ($t_arr[0] != 'orgu' || ((int) $t_arr[1]) <= 0) {
157 return false;
158 }
159 if ($ilAccess->checkAccess('read', '', $t_arr[1])) {
160 return true;
161 }
162
163 return false;
164 }
165}
An exception for terminatinating execution or to throw for unit testing.
Class ilObjOrgUnitAccess.
static _getCommands()
get commands
static _checkAccessStaffRec($ref_id)
static _checkAccessToUserLearningProgress($ref_id, $usr_id)
static _checkGoto($a_target)
check whether goto script will succeed
static _checkAccessExport($ref_id)
static _checkAccessStaff($ref_id)
static _checkAccessAdministrateUsers($ref_id)
Class ilObjectAccess.
static getInstance()
Singelton get instance.
global $DIC
Definition: saml.php:7