ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Role.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
28 use ilObjUser;
29 use ilRbacReview;
31 
32 class 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 
56  public function definition(): ConditionDefinition
57  {
58  return $this->definition;
59  }
60 
61  public function knownToNeverMatchWith(Condition $other): bool
62  {
63  return false;
64  }
65 }
knownToNeverMatchWith(Condition $other)
Definition: Role.php:61
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(private readonly CriterionContent $criterion, private readonly RoleDefinition $definition, private readonly UIFactory $create, private readonly ilRbacReview $review)
Definition: Role.php:34