1 | <?php |
||
24 | class Role implements IRole |
||
25 | { |
||
26 | /** |
||
27 | * Implement nette smart magic |
||
28 | */ |
||
29 | use Nette\SmartObject; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $id; |
||
35 | |||
36 | /** |
||
37 | * @var IRole|NULL |
||
38 | */ |
||
39 | protected $parent; |
||
40 | |||
41 | /** |
||
42 | * @var \SplObjectStorage |
||
43 | */ |
||
44 | protected $children; |
||
45 | |||
46 | /** |
||
47 | * @var string|NULL |
||
48 | */ |
||
49 | protected $name; |
||
50 | |||
51 | /** |
||
52 | * @var string|NULL |
||
53 | */ |
||
54 | protected $comment; |
||
55 | |||
56 | /** |
||
57 | * @var \SplObjectStorage |
||
58 | */ |
||
59 | protected $permissions; |
||
60 | |||
61 | /** |
||
62 | * @param string $id |
||
63 | * @param string|NULL $name |
||
64 | * @param string|NULL $comment |
||
65 | */ |
||
66 | public function __construct(string $id, string $name = NULL, string $comment = NULL) |
||
78 | |||
79 | /** |
||
80 | * {@inheritdoc} |
||
81 | */ |
||
82 | public function setParent(IRole $parent = NULL) |
||
86 | |||
87 | /** |
||
88 | * {@inheritdoc} |
||
89 | */ |
||
90 | public function getParent() |
||
94 | |||
95 | /** |
||
96 | * {@inheritdoc} |
||
97 | */ |
||
98 | public function setChildren(array $roles) |
||
108 | |||
109 | /** |
||
110 | * {@inheritdoc} |
||
111 | */ |
||
112 | public function addChild(IRole $role) |
||
118 | |||
119 | /** |
||
120 | * {@inheritdoc} |
||
121 | */ |
||
122 | public function getChildren() : array |
||
126 | |||
127 | /** |
||
128 | * {@inheritdoc} |
||
129 | */ |
||
130 | public function getRoleId() : string |
||
134 | |||
135 | /** |
||
136 | * {@inheritdoc} |
||
137 | */ |
||
138 | public function setName(string $name) |
||
142 | |||
143 | /** |
||
144 | * {@inheritdoc} |
||
145 | */ |
||
146 | public function getName() |
||
150 | |||
151 | /** |
||
152 | * {@inheritdoc} |
||
153 | */ |
||
154 | public function setComment(string $comment) |
||
158 | |||
159 | /** |
||
160 | * {@inheritdoc} |
||
161 | */ |
||
162 | public function getComment() |
||
166 | |||
167 | /** |
||
168 | * {@inheritdoc} |
||
169 | */ |
||
170 | public function setPermissions(array $permissions) |
||
180 | |||
181 | /** |
||
182 | * {@inheritdoc} |
||
183 | */ |
||
184 | public function addPermission(IPermission $permission) |
||
190 | |||
191 | /** |
||
192 | * {@inheritdoc} |
||
193 | */ |
||
194 | public function getPermissions() : array |
||
198 | |||
199 | /** |
||
200 | * {@inheritdoc} |
||
201 | */ |
||
202 | public function hasPermission(IPermission $permission) : bool |
||
206 | |||
207 | /** |
||
208 | * {@inheritdoc} |
||
209 | */ |
||
210 | public function removePermission(IPermission $permission) |
||
218 | |||
219 | /** |
||
220 | * {@inheritdoc} |
||
221 | */ |
||
222 | public function clearPermissions() |
||
226 | |||
227 | /** |
||
228 | * {@inheritdoc} |
||
229 | */ |
||
230 | public function isLocked() : bool |
||
234 | |||
235 | /** |
||
236 | * {@inheritdoc} |
||
237 | */ |
||
238 | public function isAnonymous() : bool |
||
242 | |||
243 | /** |
||
244 | * {@inheritdoc} |
||
245 | */ |
||
246 | public function isAuthenticated() : bool |
||
250 | |||
251 | /** |
||
252 | * {@inheritdoc} |
||
253 | */ |
||
254 | public function isAdministrator() : bool |
||
258 | |||
259 | /** |
||
260 | * Convert role object to string |
||
261 | * |
||
262 | * @return string |
||
263 | */ |
||
264 | public function __toString() |
||
268 | } |
||
269 |