ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilObjWebDAVAccess.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
28 {
32 
33  public function __construct()
34  {
35  global $DIC;
36  $this->rbacsystem = $DIC->rbac()->system();
37  $this->http = $DIC->http()->wrapper()->query();
38  $this->int_trafo = $DIC->refinery()->kindlyTo()->int();
39  }
40 
41  public function checkAccessAndThrowException(string $permission): void
42  {
43  if (!$this->hasUserPermissionTo($permission)) {
44  throw new ilException('Permission denied');
45  }
46  }
47 
48  public function hasUserPermissionTo(string $permission): bool
49  {
50  if (!$this->http->has('ref_id')) {
51  return false;
52  }
53  return $this->rbacsystem->checkAccess(
54  $permission,
55  $this->http->retrieve('ref_id', $this->int_trafo)
56  );
57  }
58 }
checkAccessAndThrowException(string $permission)
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26
hasUserPermissionTo(string $permission)
A transformation is a function from one datatype to another.