ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjWebDAVAccess.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
24 
29 {
33 
34  public function __construct()
35  {
36  global $DIC;
37  $this->rbacsystem = $DIC->rbac()->system();
38  $this->http = $DIC->http()->wrapper()->query();
39  $this->int_trafo = $DIC->refinery()->kindlyTo()->int();
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  public function hasUserPermissionTo(string $permission): bool
50  {
51  if (!$this->http->has('ref_id')) {
52  return false;
53  }
54  return $this->rbacsystem->checkAccess(
55  $permission,
56  $this->http->retrieve('ref_id', $this->int_trafo)
57  );
58  }
59 }
checkAccessAndThrowException(string $permission)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
Interface RequestWrapper.
hasUserPermissionTo(string $permission)
A transformation is a function from one datatype to another.