ILIAS  release_8 Revision v8.24
class.ilObjWebDAVAccess.php
Go to the documentation of this file.
1<?php
2
3declare(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}
Class Services.
Definition: Services.php:38
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkAccessAndThrowException(string $permission)
hasUserPermissionTo(string $permission)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
global $DIC
Definition: feed.php:28
Interface RequestWrapper.
A transformation is a function from one datatype to another.
static http()
Fetches the global http state from ILIAS.