ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjWebDAVAccess.php
Go to the documentation of this file.
1<?php
2
19declare(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}
Base class for ILIAS Exception handling.
checkAccessAndThrowException(string $permission)
hasUserPermissionTo(string $permission)
Class ilObjectAccess.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
Interface RequestWrapper.
A transformation is a function from one datatype to another.
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26