ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjPollAccess Class Reference

Class ilObjPollAccess. 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 _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

Constructor & Destructor Documentation

◆ __construct()

ilObjPollAccess::__construct ( )

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

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

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 46 of file class.ilObjPollAccess.php.

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

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

◆ _checkGoto()

static ilObjPollAccess::_checkGoto ( string  $target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

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

81 : bool
82 {
83 global $DIC;
84
85 $ilAccess = $DIC->access();
86
87 $t_arr = explode("_", $target);
88
89 if ($t_arr[0] !== "poll" || ((int) $t_arr[1]) <= 0) {
90 return false;
91 }
92
93 if ($ilAccess->checkAccess("read", "", (int) $t_arr[1])) {
94 return true;
95 }
96
97 return false;
98 }

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 70 of file class.ilObjPollAccess.php.

70 : array
71 {
72 return [
73 ["permission" => "read", "cmd" => "preview", "lang_var" => "show", "default" => true],
74 ["permission" => "write", "cmd" => "render", "lang_var" => "edit"]
75 ];
76 }

◆ canBeDelivered()

ilObjPollAccess::canBeDelivered ( ilWACPath  $ilWACPath)

Reimplemented from ilObjectAccess.

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

104 : bool
105 {
106 $ilAccess = $this->access;
107 preg_match("/\\/poll_([\\d]*)\\//uism", $ilWACPath->getPath(), $results);
108
109 foreach (ilObject2::_getAllReferences((int) $results[1]) as $ref_id) {
110 if ($ilAccess->checkAccess('read', '', $ref_id)) {
111 return true;
112 }
113 }
114
115 return false;
116 }
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:66
$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 31 of file class.ilObjPollAccess.php.

Referenced by _checkAccess(), and canBeDelivered().

◆ $lng

ilLanguage ilObjPollAccess::$lng
protected

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

Referenced by _checkAccess().

◆ $rbacsystem

ilRbacSystem ilObjPollAccess::$rbacsystem
protected

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

Referenced by _checkAccess().

◆ $user

ilObjUser ilObjPollAccess::$user
protected

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

Referenced by _checkAccess().


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