ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjFileServicesAccess.php
Go to the documentation of this file.
1 <?php
2 
8 {
12  private $http;
16  private $rbacsystem;
17 
21  public function __construct()
22  {
23  global $DIC;
24  $this->rbacsystem = $DIC->rbac()->system();
25  $this->http = $DIC->http();
26  }
27 
32  public function checkAccessAndThrowException(string $permission) : void
33  {
34  if (!$this->hasUserPermissionTo($permission)) {
35  throw new ilException('Permission denied');
36  }
37  }
38 
43  public function hasUserPermissionTo(string $permission) : bool
44  {
45  return (bool) $this->rbacsystem->checkAccess($permission, $this->http->request()->getQueryParams()['ref_id']);
46  }
47 
48 }
checkAccessAndThrowException(string $permission)
Class ilObjFileServicesAccess.
static http()
Fetches the global http state from ILIAS.
__construct()
ilObjFileServicesAccess constructor.
global $DIC
Definition: goto.php:24