ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjAdministrativeNotificationAccess.php
Go to the documentation of this file.
1<?php
2
8{
9
13 private $http;
17 private $rbacsystem;
18
22 public function __construct()
23 {
24 global $DIC;
25 $this->rbacsystem = $DIC->rbac()->system();
26 $this->http = $DIC->http();
27 }
28
33 public function checkAccessAndThrowException(string $permission) : void
34 {
35 if (!$this->hasUserPermissionTo($permission)) {
36 throw new ilException('Permission denied');
37 }
38 }
39
44 public function hasUserPermissionTo(string $permission) : bool
45 {
46 return (bool) $this->rbacsystem->checkAccess($permission, $this->http->request()->getQueryParams()['ref_id']);
47 }
48}
An exception for terminatinating execution or to throw for unit testing.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct()
ilObjAdministrativeNotificationAccess constructor.
Class ilObjectAccess.
global $DIC
Definition: goto.php:24
static http()
Fetches the global http state from ILIAS.