ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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)
 
 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 _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

Constructor & Destructor Documentation

◆ __construct()

ilObjPollAccess::__construct ( )

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

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

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

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

46  : bool
47  {
48  $ilUser = $this->user;
49  $lng = $this->lng;
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

◆ _checkGoto()

static ilObjPollAccess::_checkGoto ( string  $target)
static

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

References $DIC.

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

◆ _getCommands()

static ilObjPollAccess::_getCommands ( )
static

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)

Implements ilWACCheckingClass.

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

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

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