ILIAS  release_8 Revision v8.24
ilObjPollAccess 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 ilObjPollAccess:
+ Collaboration diagram for ilObjPollAccess:

Public Member Functions

 __construct ()
 
 _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. 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 _isActivated (int $a_ref_id)
 
static _getCommands ()
 get commandsthis method returns an array of all possible commands/permission combinationsexample: $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}[]
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...
 

Protected Attributes

ilObjUser $user
 
ilLanguage $lng
 
ilRbacSystem $rbacsystem
 
ilAccessHandler $access
 

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 ilObjPollAccess

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

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

Constructor & Destructor Documentation

◆ __construct()

ilObjPollAccess::__construct ( )

Definition at line 34 of file class.ilObjPollAccess.php.

35 {
36 global $DIC;
37
38 $this->user = $DIC->user();
39 $this->lng = $DIC->language();
40 $this->rbacsystem = $DIC->rbac()->system();
41 $this->access = $DIC->access();
42 }
global $DIC
Definition: feed.php:28

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _checkAccess()

ilObjPollAccess::_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 47 of file class.ilObjPollAccess.php.

47 : bool
48 {
52 $ilAccess = $this->access;
53
54 if (!$user_id) {
55 $a_user_id = $ilUser->getId();
56 }
57
58 if (
59 $cmd === 'preview' &&
60 $permission === 'read'
61 ) {
62 return false;
63 }
64
65 return true;
66 }
ilAccessHandler $access
$ilUser
Definition: imgupload.php:34

References $access, $ilUser, $lng, $rbacsystem, and $user.

◆ _checkGoto()

static ilObjPollAccess::_checkGoto ( string  $target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

Definition at line 99 of file class.ilObjPollAccess.php.

99 : bool
100 {
101 global $DIC;
102
103 $ilAccess = $DIC->access();
104
105 $t_arr = explode("_", $target);
106
107 if ($t_arr[0] !== "poll" || ((int) $t_arr[1]) <= 0) {
108 return false;
109 }
110
111 if ($ilAccess->checkAccess("read", "", (int) $t_arr[1])) {
112 return true;
113 }
114
115 return false;
116 }

References $DIC.

◆ _getCommands()

static ilObjPollAccess::_getCommands ( )
static

get commandsthis method returns an array of all possible commands/permission combinationsexample: $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 88 of file class.ilObjPollAccess.php.

88 : array
89 {
90 return [
91 ["permission" => "read", "cmd" => "preview", "lang_var" => "show", "default" => true],
92 ["permission" => "write", "cmd" => "render", "lang_var" => "edit"]
93 ];
94 }

◆ _isActivated()

static ilObjPollAccess::_isActivated ( int  $a_ref_id)
static

Definition at line 68 of file class.ilObjPollAccess.php.

68 : bool
69 {
70 $item = ilObjectActivation::getItem($a_ref_id);
71 switch ($item['timing_type']) {
73 if (time() < $item['timing_start'] or
74 time() > $item['timing_end']) {
75 return false;
76 }
77 // fallthrough
78
79 // no break
80 default:
81 return true;
82 }
83 }
static getItem(int $ref_id)

References ilObjectActivation\getItem(), and ilObjectActivation\TIMINGS_ACTIVATION.

Referenced by ilPollBlock\hasAnyContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canBeDelivered()

ilObjPollAccess::canBeDelivered ( ilWACPath  $ilWACPath)

Reimplemented from ilObjectAccess.

Definition at line 122 of file class.ilObjPollAccess.php.

122 : bool
123 {
124 $ilAccess = $this->access;
125 preg_match("/\\/poll_([\\d]*)\\//uism", $ilWACPath->getPath(), $results);
126
127 foreach (ilObject2::_getAllReferences((int) $results[1]) as $ref_id) {
128 if ($ilAccess->checkAccess('read', '', $ref_id)) {
129 return true;
130 }
131 }
132
133 return false;
134 }
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:67
$results

References $access, $ref_id, $results, ilObject\_getAllReferences(), and ilWACPath\getPath().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilObjPollAccess::$access
protected

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

Referenced by _checkAccess(), and canBeDelivered().

◆ $lng

ilLanguage ilObjPollAccess::$lng
protected

Definition at line 30 of file class.ilObjPollAccess.php.

Referenced by _checkAccess().

◆ $rbacsystem

ilRbacSystem ilObjPollAccess::$rbacsystem
protected

Definition at line 31 of file class.ilObjPollAccess.php.

Referenced by _checkAccess().

◆ $user

ilObjUser ilObjPollAccess::$user
protected

Definition at line 29 of file class.ilObjPollAccess.php.

Referenced by _checkAccess().


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