ILIAS  release_8 Revision v8.23
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)
 
 canBeDelivered (ilWACPath $ilWACPath)
 
- Public Member Functions inherited from ilObjectAccess
 _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)
 

Static Public Member Functions

static _isActivated (int $a_ref_id)
 
static _getCommands ()
 
static _checkGoto (string $target)
 
- 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.

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

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
+ 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 
)

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

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

47  : bool
48  {
50  $lng = $this->lng;
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

◆ _checkGoto()

static ilObjPollAccess::_checkGoto ( string  $target)
static

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

References $DIC.

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  }
global $DIC
Definition: feed.php:28

◆ _getCommands()

static ilObjPollAccess::_getCommands ( )
static

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.

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

Referenced by ilPollBlock\hasAnyContent().

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)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canBeDelivered()

ilObjPollAccess::canBeDelivered ( ilWACPath  $ilWACPath)

Implements ilWACCheckingClass.

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

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

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
ilAccessHandler $access
$ref_id
Definition: ltiauth.php:67
$results
+ 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: