ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilLearningProgressAccess.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
34{
38 public static function checkPermission($a_permission, $a_ref_id, $a_user_id = null)
39 {
40 if (is_null($a_user_id)) {
41 $a_user_id = $GLOBALS['DIC']['ilUser']->getId();
42 }
43
44 // position access
45 if ($a_permission == 'read_learning_progress') {
46 return $GLOBALS['DIC']->access()->checkRbacOrPositionPermissionAccess(
47 'read_learning_progress',
48 'read_learning_progress',
49 $a_ref_id
50 );
51 }
52 return $GLOBALS['DIC']['ilAccess']->checkAccessOfUser($a_user_id, $a_permission, '', $a_ref_id);
53 }
54
55
64 public static function checkAccess($a_ref_id, $a_allow_only_read = true)
65 {
66 global $DIC;
67
68 if ($DIC->user()->getId() == ANONYMOUS_USER_ID) {
69 return false;
70 }
71
73 return false;
74 }
75
77 if (
78 $DIC->access()->checkAccess('read_learning_progress', '', $a_ref_id) ||
79 (
80 $DIC->access()->checkRbacOrPositionPermissionAccess(
81 'read_learning_progress',
83 $a_ref_id
84 ) && $olp->isActive()
85 )
86 ) {
87 return true;
88 }
89
91 return false;
92 }
93
94 if (!$olp->isActive()) {
95 return false;
96 }
97
98 if (!$DIC->access()->checkAccess('read', '', $a_ref_id)) {
99 return false;
100 }
101
102 if ($a_allow_only_read) {
103 return true;
104 }
105
106 return false;
107 }
108}
An exception for terminatinating execution or to throw for unit testing.
Learning progress access checks.
static checkPermission($a_permission, $a_ref_id, $a_user_id=null)
wrapper for rbac access checks
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
static _enabledLearningProgress()
check wether learing progress is enabled or not
static getInstance($a_obj_id)
static _lookupObjId($a_id)
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
global $DIC
Definition: saml.php:7