ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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['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 $ilUser, $ilSetting;
73
74 preg_match("/usr_(\\d*).*/ui", $ilWACPath->getFileName(), $matches);
75 $usr_id = $matches[1];
76
77 // check if own image is viewed
78 if ($usr_id == $ilUser->getId()) {
79 return true;
80 }
81
82 // check if image is in the public profile
83 $public_upload = ilObjUser::_lookupPref($usr_id, 'public_upload');
84 if ($public_upload != 'y') {
85 return false;
86 }
87
88 // check the publication status of the profile
89 $public_profile = ilObjUser::_lookupPref($usr_id, 'public_profile');
90
91 if ($public_profile == 'g' and $ilSetting->get('enable_global_profiles') and $ilSetting->get('pub_section')) {
92 // globally public
93 return true;
94 } elseif (($public_profile == 'y' or $public_profile == 'g') and $ilUser->getId() != ANONYMOUS_USER_ID && $ilUser->getId() != 0) {
95 // public for logged in users
96 return true;
97 } else {
98 // not public
99 return false;
100 }
101 }
102}
sprintf('%.4f', $callTime)
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.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Class ilWACCheckingClass.
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18