ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilOrgUnitPermission.php
Go to the documentation of this file.
1 <?php
2 
25 {
26  public const PARENT_TEMPLATE = -1;
27  public const TABLE_NAME = 'il_orgu_permissions';
28 
29  protected int $id = 0;
30  protected int $parent_id = self::PARENT_TEMPLATE;
31  protected int $context_id = 0;
32  protected int $position_id = 0;
33  protected bool $protected = false;
37  protected array $operations = [];
38 
42  protected array $possible_operations = [];
46  protected array $selected_operation_ids = [];
48 
49  public function __construct($id = 0)
50  {
51  $this->id = $id;
52  }
53 
54  public function getId(): ?int
55  {
56  return $this->id;
57  }
58 
59  public function getParentId(): int
60  {
61  return $this->parent_id;
62  }
63 
64  public function withParentId(int $parent_id): self
65  {
66  $clone = clone $this;
67  $clone->parent_id = $parent_id;
68  return $clone;
69  }
70 
71  public function getContextId(): int
72  {
73  return $this->context_id;
74  }
75 
76  public function withContextId(int $context_id): self
77  {
78  $clone = clone $this;
79  $clone->context_id = $context_id;
80  return $clone;
81  }
82 
83  public function getPositionId(): int
84  {
85  return $this->position_id;
86  }
87 
88  public function withPositionId(int $position_id): self
89  {
90  $clone = clone $this;
91  $clone->position_id = $position_id;
92  return $clone;
93  }
94 
98  public function getOperations(): array
99  {
100  return $this->operations;
101  }
102 
103  public function withOperations(array $operations): self
104  {
105  $clone = clone $this;
106  $clone->operations = $operations;
107  return $clone;
108  }
109 
110  public function getPossibleOperations(): array
111  {
113  }
114 
115  public function withPossibleOperations(array $possible_operations): self
116  {
117  $clone = clone $this;
118  $clone->possible_operations = $possible_operations;
119  return $clone;
120  }
121 
122  public function getSelectedOperationIds(): array
123  {
125  }
126 
127  public function withSelectedOperationIds(array $selected_operation_ids): self
128  {
129  $clone = clone $this;
130  $clone->selected_operation_ids = $selected_operation_ids;
131  return $clone;
132  }
133 
134  public function isOperationIdSelected(int $operation_id): bool
135  {
136  return in_array($operation_id, $this->selected_operation_ids);
137  }
138 
140  {
141  return $this->context;
142  }
143 
144  public function withContext(ilOrgUnitOperationContext $context): self
145  {
146  $clone = clone $this;
147  $clone->context = $context;
148  return $clone;
149  }
150 
151  public function isProtected(): bool
152  {
153  return $this->protected;
154  }
155 
156  public function withProtected(bool $protected): self
157  {
158  $clone = clone $this;
159  $clone->protected = $protected;
160  return $clone;
161  }
162 
163  public function isTemplate(): bool
164  {
165  return ($this->getParentId() === self::PARENT_TEMPLATE);
166  }
167 }
withPositionId(int $position_id)
ilOrgUnitOperationContext $context
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isOperationIdSelected(int $operation_id)
withOperations(array $operations)
withPossibleOperations(array $possible_operations)
withSelectedOperationIds(array $selected_operation_ids)
withContext(ilOrgUnitOperationContext $context)