ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\GlobalScreen\GUI\Access\Access Class Reference
+ Collaboration diagram for ILIAS\GlobalScreen\GUI\Access\Access:

Public Member Functions

 __construct (RBACServices $rbac, Services $http, Factory $refinery,)
 ilObjMainMenuAccess constructor. More...
 
 checkAccessAndThrowException (string $permission)
 
 hasUserPermissionTo (string $permission)
 
 __destruct ()
 
 requireReadable ()
 
 requireWritable ()
 

Private Attributes

ilRbacSystem $rbac_system
 
int $ref_id = null
 
bool $access_checked = false
 

Detailed Description

Author
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 31 of file Access.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\GlobalScreen\GUI\Access\Access::__construct ( RBACServices  $rbac,
Services  $http,
Factory  $refinery 
)

ilObjMainMenuAccess constructor.

Definition at line 41 of file Access.php.

45 {
46 $this->rbac_system = $rbac->system();
47 $this->ref_id = $http->wrapper()->query()->has('ref_id')
48 ? $http->wrapper()->query()->retrieve('ref_id', $refinery->kindlyTo()->int())
49 : null;
50 }
system()
Get the interface to the RBAC system.
$http
Definition: deliver.php:30

References $http, ILIAS\UI\examples\Layout\Page\Standard\$refinery, and ILIAS\DI\RBACServices\system().

+ Here is the call graph for this function:

◆ __destruct()

ILIAS\GlobalScreen\GUI\Access\Access::__destruct ( )

Definition at line 76 of file Access.php.

77 {
78 if (!$this->access_checked) {
79 // throw new \RuntimeException('No Access Check');
80 }
81 }

Member Function Documentation

◆ checkAccessAndThrowException()

ILIAS\GlobalScreen\GUI\Access\Access::checkAccessAndThrowException ( string  $permission)

Definition at line 52 of file Access.php.

52 : void
53 {
54 if (!$this->hasUserPermissionTo($permission)) {
55 throw new \ilException('Permission denied');
56 }
57 }
hasUserPermissionTo(string $permission)
Definition: Access.php:59

References ILIAS\GlobalScreen\GUI\Access\Access\hasUserPermissionTo().

+ Here is the call graph for this function:

◆ hasUserPermissionTo()

ILIAS\GlobalScreen\GUI\Access\Access::hasUserPermissionTo ( string  $permission)

Definition at line 59 of file Access.php.

59 : bool
60 {
61 if ($this->ref_id === null) {
62 return false;
63 }
64 // split permission string
65 $permissions = explode(',', $permission);
66 foreach ($permissions as $p) {
67 if ($this->rbac_system->checkAccess($p, $this->ref_id)) {
68 $this->access_checked = true;
69 return true;
70 }
71 }
72 $this->access_checked = true;
73 return false;
74 }

Referenced by ILIAS\GlobalScreen\GUI\Access\Access\checkAccessAndThrowException().

+ Here is the caller graph for this function:

◆ requireReadable()

ILIAS\GlobalScreen\GUI\Access\Access::requireReadable ( )

Definition at line 83 of file Access.php.

83 : void
84 {
85 $this->require('read');
86 }

◆ requireWritable()

ILIAS\GlobalScreen\GUI\Access\Access::requireWritable ( )

Definition at line 88 of file Access.php.

88 : void
89 {
90 $this->require('write');
91 }

Field Documentation

◆ $access_checked

bool ILIAS\GlobalScreen\GUI\Access\Access::$access_checked = false
private

Definition at line 36 of file Access.php.

◆ $rbac_system

ilRbacSystem ILIAS\GlobalScreen\GUI\Access\Access::$rbac_system
private

Definition at line 33 of file Access.php.

◆ $ref_id

int ILIAS\GlobalScreen\GUI\Access\Access::$ref_id = null
private

Definition at line 34 of file Access.php.


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