ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Role.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
28use ilObjUser;
29use ilRbacReview;
30use ILIAS\UI\Factory as UIFactory;
31
32class Role implements Condition
33{
34 public function __construct(
35 private readonly CriterionContent $criterion,
36 private readonly RoleDefinition $definition,
37 private readonly UIFactory $create,
38 private readonly ilRbacReview $review
39 ) {
40 }
41
42 public function asComponent(): Component
43 {
44 return $this->create->legacy()->content(sprintf(
45 '<div><b>%s</b><br/>%s</div>',
46 $this->definition->translatedType(),
47 $this->definition->translatedRole((int) $this->criterion->arguments()['role_id'])
48 ));
49 }
50
51 public function eval(ilObjUser $user): bool
52 {
53 return $this->review->isAssigned($user->getId(), (int) $this->criterion->arguments()['role_id']);
54 }
55
57 {
58 return $this->definition;
59 }
60
61 public function knownToNeverMatchWith(Condition $other): bool
62 {
63 return false;
64 }
65}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
__construct(private readonly CriterionContent $criterion, private readonly RoleDefinition $definition, private readonly UIFactory $create, private readonly ilRbacReview $review)
Definition: Role.php:34
knownToNeverMatchWith(Condition $other)
Definition: Role.php:61
User class.
class ilRbacReview Contains Review functions of core Rbac.
A component is the most general form of an entity in the UI.
Definition: Component.php:28