ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilObjFileServicesAccess.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
28 {
29  private Services $http;
30  private \ilRbacSystem $rbacsystem;
31 
35  public function __construct()
36  {
37  global $DIC;
38  $this->rbacsystem = $DIC->rbac()->system();
39  $this->http = $DIC->http();
40  }
41 
42  public function checkAccessAndThrowException(string $permission): void
43  {
44  if (!$this->hasUserPermissionTo($permission)) {
45  throw new ilException('Permission denied');
46  }
47  }
48 
49 
50  public function hasUserPermissionTo(string $permission): bool
51  {
52  return $this->rbacsystem->checkAccess($permission, $this->http->request()->getQueryParams()['ref_id']);
53  }
54 }
checkAccessAndThrowException(string $permission)
Class ilObjFileServicesAccess.
static http()
Fetches the global http state from ILIAS.
__construct()
ilObjFileServicesAccess constructor.
global $DIC
Definition: shib_login.php:22