ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 */
3require_once('./Services/Object/classes/class.ilObjectAccess.php');
4require_once('./Services/User/classes/class.ilUserAccountSettings.php');
13
26 public static function _getCommands()
27 {
28 $commands = array();
29 $commands[] = array( 'permission' => 'read', 'cmd' => 'view', 'lang_var' => 'show', 'default' => true );
30// $commands[] = array('permission' => 'read', 'cmd' => 'render', 'lang_var' => 'show', 'default' => true);
31// $commands[] = array('permission' => 'write', 'cmd' => 'enableAdministrationPanel', 'lang_var' => 'edit_content');
32// $commands[] = array( 'permission' => 'write', 'cmd' => 'edit', 'lang_var' => 'settings' );
33
34 return $commands;
35 }
36
37
43 public static function _checkAccessStaff($ref_id) {
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 global $DIC;
63 $ilAccess = $DIC['ilAccess'];
64
65 if (($ilAccess->checkAccess("write", "", $ref_id)
66 OR $ilAccess->checkAccess("view_learning_progress_rec", "", $ref_id))
67 AND $ilAccess->checkAccess("read", "", $ref_id)) {
68 return true;
69 }
70
71 return false;
72 }
73
79 public static function _checkAccessAdministrateUsers($ref_id) {
80 global $DIC;
81 $ilAccess = $DIC['ilAccess'];
82
83 if (ilUserAccountSettings::getInstance()->isLocalUserAdministrationEnabled() AND
84 $ilAccess->checkAccess('cat_administrate_users', "", $ref_id)) {
85 return true;
86 }
87
88 return false;
89 }
90
97 public static function _checkAccessToUserLearningProgress($ref_id,$usr_id) {
98 global $DIC;
99 $ilAccess = $DIC['ilAccess'];
100
101 //Permission to view the Learning Progress of an OrgUnit: Employees
102 if ($ilAccess->checkAccess("view_learning_progress", "", $ref_id)
103 AND in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getEmployees($ref_id, false))) {
104 return true;
105 }
106 //Permission to view the Learning Progress of an OrgUnit: Superiors
107 if ($ilAccess->checkAccess("view_learning_progress", "", $ref_id)
108 AND in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getSuperiors($ref_id, false))) {
109 return true;
110 }
111
112 //Permission to view the Learning Progress of an OrgUnit or SubOrgUnit!: Employees
113 if ($ilAccess->checkAccess("view_learning_progress_rec", "", $ref_id)
114 AND in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getEmployees($ref_id, true))) {
115 return true;
116 }
117
118 //Permission to view the Learning Progress of an OrgUnit or SubOrgUnit!: Superiors
119 if ($ilAccess->checkAccess("view_learning_progress_rec", "", $ref_id)
120 AND in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getSuperiors($ref_id, true))) {
121 return true;
122 }
123
124 return false;
125 }
126
127
131 public static function _checkGoto($a_target)
132 {
133 global $DIC;
134 $ilAccess = $DIC['ilAccess'];
135 $t_arr = explode('_', $a_target);
136 if ($t_arr[0] != 'orgu' || ((int)$t_arr[1]) <= 0) {
137 return false;
138 }
139 if ($ilAccess->checkAccess('read', '', $t_arr[1])) {
140 return true;
141 }
142
143 return false;
144 }
145}
146?>
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.
$ref_id
Definition: sahs_server.php:39
global $DIC