ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilOrgUnitAuthority.php
Go to the documentation of this file.
1 <?php
2 
20 declare(strict_types=1);
21 
27 {
28  public const FIELD_OVER = 'over';
29  public const OVER_EVERYONE = -1;
30  public const POSITION_ID = "position_id";
31  public const SCOPE_SAME_ORGU = 1;
32  public const SCOPE_SUBSEQUENT_ORGUS = 2;
33  public const SCOPES = [
34  self::SCOPE_SAME_ORGU,
35  self::SCOPE_SUBSEQUENT_ORGUS
36  ];
37 
38  protected int $id;
39  protected int $over = self::OVER_EVERYONE;
40  protected int $scope = self::SCOPE_SAME_ORGU;
41  protected int $position_id = 0;
42 
43  public function __construct($id = 0)
44  {
45  $this->id = $id;
46  }
47 
51  public static function getScopes(): array
52  {
53  return self::SCOPES;
54  }
55 
56  public function __toString(): string
57  {
58  return (string) $this->id;
59  }
60 
61  public function getId(): int
62  {
63  return $this->id;
64  }
65 
66  public function getOver(): int
67  {
68  return $this->over;
69  }
70 
71  public function withOver(int $over): self
72  {
73  $clone = clone $this;
74  $clone->over = $over;
75  return $clone;
76  }
77 
78  public function getScope(): int
79  {
80  return $this->scope;
81  }
82 
83  public function withScope(int $scope): self
84  {
85  if (!in_array($scope, self::SCOPES)) {
86  throw new ilException('Selected Scope in ' . self::class . ' not allowed');
87  }
88  $clone = clone $this;
89  $clone->scope = $scope;
90  return $clone;
91  }
92 
93  public function getPositionId(): int
94  {
95  return $this->position_id;
96  }
97 
98  public function withPositionId(int $position_id): self
99  {
100  $clone = clone $this;
101  $clone->position_id = $position_id;
102  return $clone;
103  }
104 }
withPositionId(int $position_id)
Class ilOrguAuthority.