ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjMainMenuAccess.php
Go to the documentation of this file.
1 <?php
2 
9 {
10 
14  private $http;
18  private $rbacsystem;
19 
20 
24  public function __construct()
25  {
26  global $DIC;
27  $this->rbacsystem = $DIC->rbac()->system();
28  $this->http = $DIC->http();
29  }
30 
31 
37  public function checkAccessAndThrowException(string $permission)
38  {
39  if (!$this->hasUserPermissionTo($permission)) {
40  //throw new ilException('Permission denied');
41 
42  echo "KEIN ZUGRIFF!!";
43  exit;
44  }
45  }
46 
47 
53  public function hasUserPermissionTo(string $permission) : bool
54  {
55  return (bool) $this->rbacsystem->checkAccess($permission, $this->http->request()->getQueryParams()['ref_id']);
56  }
57 }
global $DIC
Definition: saml.php:7
static http()
Fetches the global http state from ILIAS.
__construct()
ilObjMainMenuAccess constructor.
exit
Definition: backend.php:16
Class ilObjectAccess.
checkAccessAndThrowException(string $permission)
Class ilObjMainMenuAccess.
hasUserPermissionTo(string $permission)