ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjUserAccess.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Object/classes/class.ilObjectAccess.php");
5require_once('./Services/WebAccessChecker/interfaces/interface.ilWACCheckingClass.php');
6
19{
20 public static function _getCommands()
21 {
22 die();
23 }
24
25
26 public function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
27 {
28 die();
29 }
30
31
35 public static function _checkGoto($a_target)
36 {
37 $settings = isset($GLOBALS['DIC']) ? $GLOBALS['DIC']->settings() : $GLOBALS['DIC']['ilSetting'];
38
39 if ('usr_registration' == $a_target) {
40 require_once 'Services/Registration/classes/class.ilRegistrationSettings.php';
41 $regSeetings = new ilRegistrationSettings();
42 if ($regSeetings->getRegistrationType() == IL_REG_DISABLED) {
43 $GLOBALS['DIC']->language()->loadLanguageModule('registration');
44 ilUtil::sendFailure(sprintf($GLOBALS['DIC']->language()->txt('registration_disabled_no_access'), $settings->get('admin_email')), true);
45 return false;
46 }
47 } elseif ('usr_nameassist' == $a_target) {
48 if (!$settings->get('password_assistance')) {
49 $GLOBALS['DIC']->language()->loadLanguageModule('pwassist');
50 ilUtil::sendFailure(sprintf($GLOBALS['DIC']->language()->txt('unassist_disabled_no_access'), $settings->get('admin_email')), true);
51 return false;
52 }
53 } elseif ('usr_pwassist' == $a_target) {
54 if (!$settings->get('password_assistance')) {
55 $GLOBALS['DIC']->language()->loadLanguageModule('pwassist');
56 ilUtil::sendFailure(sprintf($GLOBALS['DIC']->language()->txt('pwassist_disabled_no_access'), $settings->get('admin_email')), true);
57 return false;
58 }
59 }
60
61 return true;
62 }
63
64
70 public function canBeDelivered(ilWACPath $ilWACPath)
71 {
72 global $DIC;
73
74 $ilUser = $DIC['ilUser'];
75 $ilSetting = $DIC['ilSetting'];
76
77 preg_match("/usr_(\\d*).*/ui", $ilWACPath->getFileName(), $matches);
78 $usr_id = $matches[1];
79
80 // check if own image is viewed
81 if ($usr_id == $ilUser->getId()) {
82 return true;
83 }
84
85 // check if image is in the public profile
86 $public_upload = ilObjUser::_lookupPref($usr_id, 'public_upload');
87 if ($public_upload != 'y') {
88 return false;
89 }
90
91 // check the publication status of the profile
92 $public_profile = ilObjUser::_lookupPref($usr_id, 'public_profile');
93
94 if ($public_profile == 'g' and $ilSetting->get('enable_global_profiles') and $ilSetting->get('pub_section')) {
95 // globally public
96 return true;
97 } elseif (($public_profile == 'y' or $public_profile == 'g') and $ilUser->getId() != ANONYMOUS_USER_ID && $ilUser->getId() != 0) {
98 // public for logged in users
99 return true;
100 } else {
101 // not public
102 return false;
103 }
104 }
105}
An exception for terminatinating execution or to throw for unit testing.
Class ilObjUserAccess.
canBeDelivered(ilWACPath $ilWACPath)
_checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
Checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAcce...
static _checkGoto($a_target)
check whether goto script will succeed
static _getCommands()
get commands
static _lookupPref($a_usr_id, $a_keyword)
Class ilObjectAccess.
Class ilObjAuthSettingsGUI.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilWACPath.
Class ilWACCheckingClass.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
global $ilSetting
Definition: privfeed.php:17
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18