ILIAS  release_8 Revision v8.24
ilObjUserAccess Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilObjUserAccess:
+ Collaboration diagram for ilObjUserAccess:

Public Member Functions

 _checkAccess (string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
 Checks whether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 
 _checkAccess (string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
 Checks whether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getCommands ()
 get commands More...
 
static _checkGoto (string $target)
 check whether goto script will succeed More...
 
- Static Public Member Functions inherited from ilObjectAccess
static _getCommands ()
 get commands More...
 
static _checkGoto (string $target)
 check whether goto script will succeed More...
 
static _isOffline (int $obj_id)
 Type-specific implementation of general status, has to be overwritten if object type does not support centralized offline handling. More...
 
static _preloadData (array $obj_ids, array $ref_ids)
 Preload data. More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilObjUserAccess

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 25 of file class.ilObjUserAccess.php.

Member Function Documentation

◆ _checkAccess()

ilObjUserAccess::_checkAccess ( string  $cmd,
string  $permission,
int  $ref_id,
int  $obj_id,
?int  $user_id = null 
)

Checks whether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess)

Please do not check any preconditions handled by ilConditionHandler here. Also don't do any RBAC checks.

Reimplemented from ilObjectAccess.

Definition at line 32 of file class.ilObjUserAccess.php.

32 : bool
33 {
34 throw new ilException("_checkAccess must not be called on user object.");
35 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ _checkGoto()

static ilObjUserAccess::_checkGoto ( string  $target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

Definition at line 37 of file class.ilObjUserAccess.php.

37 : bool
38 {
39 global $DIC;
40 $main_tpl = $DIC->ui()->mainTemplate();
41 $settings = isset($GLOBALS['DIC']) ? $GLOBALS['DIC']->settings() : $GLOBALS['DIC']['ilSetting'];
42
43 if ('usr_registration' == $target) {
44 $regSeetings = new ilRegistrationSettings();
45 if ($regSeetings->getRegistrationType() == ilRegistrationSettings::IL_REG_DISABLED) {
46 $GLOBALS['DIC']->language()->loadLanguageModule('registration');
47 $main_tpl->setOnScreenMessage('failure', sprintf($GLOBALS['DIC']->language()->txt('registration_disabled_no_access'), $settings->get('admin_email')), true);
48 return false;
49 }
50 } elseif ('usr_nameassist' == $target) {
51 if (!$settings->get('password_assistance')) {
52 $GLOBALS['DIC']->language()->loadLanguageModule('pwassist');
53 $main_tpl->setOnScreenMessage('failure', sprintf($GLOBALS['DIC']->language()->txt('unassist_disabled_no_access'), $settings->get('admin_email')), true);
54 return false;
55 }
56 } elseif ('usr_pwassist' == $target) {
57 if (!$settings->get('password_assistance')) {
58 $GLOBALS['DIC']->language()->loadLanguageModule('pwassist');
59 $main_tpl->setOnScreenMessage('failure', sprintf($GLOBALS['DIC']->language()->txt('pwassist_disabled_no_access'), $settings->get('admin_email')), true);
60 return false;
61 }
62 }
63
64 return true;
65 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Class ilObjAuthSettingsGUI.
global $DIC
Definition: feed.php:28
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200

References $DIC, $GLOBALS, ILIAS\LTI\ToolProvider\$settings, ilRegistrationSettings\IL_REG_DISABLED, and ILIAS\UI\examples\Symbol\Glyph\Language\language().

+ Here is the call graph for this function:

◆ _getCommands()

static ilObjUserAccess::_getCommands ( )
static

get commands

this method returns an array of all possible commands/permission combinations

example: $commands = array ( array("permission" => "read", "cmd" => "view", "lang_var" => "show"), array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"), );

Returns
array{permission?:string, cmd?:string, lang_var?:string, default?:bool}[]

Reimplemented from ilObjectAccess.

Definition at line 27 of file class.ilObjUserAccess.php.

27 : array
28 {
29 throw new ilException("_getCommands must not be called on user object.");
30 }

◆ canBeDelivered()

ilObjUserAccess::canBeDelivered ( ilWACPath  $ilWACPath)

Reimplemented from ilObjectAccess.

Definition at line 67 of file class.ilObjUserAccess.php.

67 : bool
68 {
69 global $DIC;
70
71 $ilUser = $DIC['ilUser'];
72 $ilSetting = $DIC['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 }
static _lookupPref(int $a_usr_id, string $a_keyword)
const ANONYMOUS_USER_ID
Definition: constants.php:27
$ilUser
Definition: imgupload.php:34
global $ilSetting
Definition: privfeed.php:17

References $DIC, $ilSetting, $ilUser, ilObjUser\_lookupPref(), ANONYMOUS_USER_ID, and ilWACPath\getFileName().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: