ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjAdministrativeNotificationAccess.php
Go to the documentation of this file.
1<?php
2
24{
26
27 protected ?int $ref_id;
28
32 public function __construct()
33 {
34 global $DIC;
35 $this->rbacsystem = $DIC->rbac()->system();
36 $this->ref_id = $DIC->http()->wrapper()->query()->has('ref_id')
37 ? $DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int())
38 : null;
39 }
40
44 public function checkAccessAndThrowException(string $permission): void
45 {
46 if (!$this->hasUserPermissionTo($permission)) {
47 throw new ilException('Permission denied');
48 }
49 }
50
51 public function hasUserPermissionTo(string $permission): bool
52 {
53 return $this->rbacsystem->checkAccess($permission, $this->ref_id);
54 }
55}
Base class for ILIAS Exception handling.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct()
ilObjAdministrativeNotificationAccess constructor.
Class ilObjectAccess.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
global $DIC
Definition: shib_login.php:26