ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
99 public static function _checkAccessToUserLearningProgress($ref_id, $usr_id)
100 {
101 global $DIC;
102 $ilAccess = $DIC['ilAccess'];
103
104 //Permission to view the Learning Progress of an OrgUnit: Employees
105 if ($ilAccess->checkAccess("view_learning_progress", "", $ref_id)
106 and in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getEmployees($ref_id, false))) {
107 return true;
108 }
109 //Permission to view the Learning Progress of an OrgUnit: Superiors
110 if ($ilAccess->checkAccess("view_learning_progress", "", $ref_id)
111 and in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getSuperiors($ref_id, false))) {
112 return true;
113 }
114
115 //Permission to view the Learning Progress of an OrgUnit or SubOrgUnit!: Employees
116 if ($ilAccess->checkAccess("view_learning_progress_rec", "", $ref_id)
117 and in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getEmployees($ref_id, true))) {
118 return true;
119 }
120
121 //Permission to view the Learning Progress of an OrgUnit or SubOrgUnit!: Superiors
122 if ($ilAccess->checkAccess("view_learning_progress_rec", "", $ref_id)
123 and in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getSuperiors($ref_id, true))) {
124 return true;
125 }
126
127 return false;
128 }
129
130
134 public static function _checkGoto($a_target)
135 {
136 global $DIC;
137 $ilAccess = $DIC['ilAccess'];
138 $t_arr = explode('_', $a_target);
139 if ($t_arr[0] != 'orgu' || ((int) $t_arr[1]) <= 0) {
140 return false;
141 }
142 if ($ilAccess->checkAccess('read', '', $t_arr[1])) {
143 return true;
144 }
145
146 return false;
147 }
148}
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 _checkAccessStaff($ref_id)
static _checkAccessAdministrateUsers($ref_id)
Class ilObjectAccess.
static getInstance()
Singelton get instance.
global $DIC
Definition: saml.php:7