ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
RBACFilter.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
28
32class RBACFilter implements Filter
33{
34 public function __construct(
35 private AccessCheck $check
36 ) {
37 }
38
39 public function checkName(string $name): bool
40 {
41 return true;
42 }
43
44 public function canUserIn(Action $action, Container $in): bool
45 {
46 return $this->check->hasCurrentUserAccess($action, $in->getObjectProxy()?->getRefId());
47 }
48
49 public function canUserFor(Action $action, Entity $for): bool
50 {
51 return $this->check->hasCurrentUserAccess($action, $for->getObjectProxy()?->getRefId());
52 }
53
54 public function filterEntity(Entity $entity): bool
55 {
56 return $this->check->hasCurrentUserAccess(Action::READ, $entity->getObjectProxy()?->getRefId());
57 }
58
59 public function filterProxy(Proxy $proxy): bool
60 {
61 return $this->check->hasCurrentUserAccess(Action::READ, $proxy->getRefId());
62 }
63
64 public function canUserCreate(Type $type, Container $in): bool
65 {
66 return $this->check->canUserCreate($type, $in->getObjectProxy()?->getRefId());
67 }
68
69}
$check
Definition: buildRTE.php:81
canUserCreate(Type $type, Container $in)
Definition: RBACFilter.php:64
__construct(private AccessCheck $check)
Definition: RBACFilter.php:34
canUserFor(Action $action, Entity $for)
Definition: RBACFilter.php:49
canUserIn(Action $action, Container $in)
Definition: RBACFilter.php:44