1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* sysPass |
4
|
|
|
* |
5
|
|
|
* @author nuxsmin |
6
|
|
|
* @link https://syspass.org |
7
|
|
|
* @copyright 2012-2019, Rubén Domínguez nuxsmin@$syspass.org |
8
|
|
|
* |
9
|
|
|
* This file is part of sysPass. |
10
|
|
|
* |
11
|
|
|
* sysPass is free software: you can redistribute it and/or modify |
12
|
|
|
* it under the terms of the GNU General Public License as published by |
13
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
14
|
|
|
* (at your option) any later version. |
15
|
|
|
* |
16
|
|
|
* sysPass is distributed in the hope that it will be useful, |
17
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
18
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19
|
|
|
* GNU General Public License for more details. |
20
|
|
|
* |
21
|
|
|
* You should have received a copy of the GNU General Public License |
22
|
|
|
* along with sysPass. If not, see <http://www.gnu.org/licenses/>. |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
namespace SP\Services\Account; |
26
|
|
|
|
27
|
|
|
use SP\Core\Acl\Acl; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Class AccountAcl |
31
|
|
|
* |
32
|
|
|
* @package SP\Account |
33
|
|
|
*/ |
34
|
|
|
final class AccountAcl |
35
|
|
|
{ |
36
|
|
|
/** |
37
|
|
|
* @var bool |
38
|
|
|
*/ |
39
|
|
|
private $userInGroups = false; |
40
|
|
|
/** |
41
|
|
|
* @var bool |
42
|
|
|
*/ |
43
|
|
|
private $userInUsers = false; |
44
|
|
|
/** |
45
|
|
|
* @var bool |
46
|
|
|
*/ |
47
|
|
|
private $resultView = false; |
48
|
|
|
/** |
49
|
|
|
* @var bool |
50
|
|
|
*/ |
51
|
|
|
private $resultEdit = false; |
52
|
|
|
/** |
53
|
|
|
* @var bool |
54
|
|
|
*/ |
55
|
|
|
private $modified = false; |
56
|
|
|
/** |
57
|
|
|
* @var bool |
58
|
|
|
*/ |
59
|
|
|
private $showView = false; |
60
|
|
|
/** |
61
|
|
|
* @var bool |
62
|
|
|
*/ |
63
|
|
|
private $showHistory = false; |
64
|
|
|
/** |
65
|
|
|
* @var bool |
66
|
|
|
*/ |
67
|
|
|
private $showDetails = false; |
68
|
|
|
/** |
69
|
|
|
* @var bool |
70
|
|
|
*/ |
71
|
|
|
private $showPass = false; |
72
|
|
|
/** |
73
|
|
|
* @var bool |
74
|
|
|
*/ |
75
|
|
|
private $showFiles = false; |
76
|
|
|
/** |
77
|
|
|
* @var bool |
78
|
|
|
*/ |
79
|
|
|
private $showViewPass = false; |
80
|
|
|
/** |
81
|
|
|
* @var bool |
82
|
|
|
*/ |
83
|
|
|
private $showSave = false; |
84
|
|
|
/** |
85
|
|
|
* @var bool |
86
|
|
|
*/ |
87
|
|
|
private $showEdit = false; |
88
|
|
|
/** |
89
|
|
|
* @var bool |
90
|
|
|
*/ |
91
|
|
|
private $showEditPass = false; |
92
|
|
|
/** |
93
|
|
|
* @var bool |
94
|
|
|
*/ |
95
|
|
|
private $showDelete = false; |
96
|
|
|
/** |
97
|
|
|
* @var bool |
98
|
|
|
*/ |
99
|
|
|
private $showRestore = false; |
100
|
|
|
/** |
101
|
|
|
* @var bool |
102
|
|
|
*/ |
103
|
|
|
private $showLink = false; |
104
|
|
|
/** |
105
|
|
|
* @var bool |
106
|
|
|
*/ |
107
|
|
|
private $showCopy = false; |
108
|
|
|
/** |
109
|
|
|
* @var bool |
110
|
|
|
*/ |
111
|
|
|
private $showPermission = false; |
112
|
|
|
/** |
113
|
|
|
* @var bool |
114
|
|
|
*/ |
115
|
|
|
private $compiledAccountAccess = false; |
116
|
|
|
/** |
117
|
|
|
* @var bool |
118
|
|
|
*/ |
119
|
|
|
private $compiledShowAccess = false; |
120
|
|
|
/** |
121
|
|
|
* @var int |
122
|
|
|
*/ |
123
|
|
|
private $accountId; |
124
|
|
|
/** |
125
|
|
|
* @var int |
126
|
|
|
*/ |
127
|
|
|
private $actionId; |
128
|
|
|
/** |
129
|
|
|
* @var int |
130
|
|
|
*/ |
131
|
|
|
private $time = 0; |
132
|
|
|
/** |
133
|
|
|
* @var bool |
134
|
|
|
*/ |
135
|
|
|
private $isHistory; |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* AccountAcl constructor. |
139
|
|
|
* |
140
|
|
|
* @param int $actionId |
141
|
|
|
* @param bool $isHistory |
142
|
|
|
*/ |
143
|
|
|
public function __construct($actionId, $isHistory = false) |
144
|
|
|
{ |
145
|
|
|
$this->actionId = (int)$actionId; |
146
|
|
|
$this->isHistory = $isHistory; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @return bool |
151
|
|
|
*/ |
152
|
|
|
public function isUserInGroups(): bool |
153
|
|
|
{ |
154
|
|
|
return $this->userInGroups; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* @param bool $userInGroups |
159
|
|
|
* |
160
|
|
|
* @return AccountAcl |
161
|
|
|
*/ |
162
|
|
|
public function setUserInGroups(bool $userInGroups) |
163
|
|
|
{ |
164
|
|
|
$this->userInGroups = $userInGroups; |
165
|
|
|
|
166
|
|
|
return $this; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* @return bool |
171
|
|
|
*/ |
172
|
|
|
public function isUserInUsers(): bool |
173
|
|
|
{ |
174
|
|
|
return $this->userInUsers; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* @param bool $userInUsers |
179
|
|
|
* |
180
|
|
|
* @return AccountAcl |
181
|
|
|
*/ |
182
|
|
|
public function setUserInUsers(bool $userInUsers) |
183
|
|
|
{ |
184
|
|
|
$this->userInUsers = $userInUsers; |
185
|
|
|
|
186
|
|
|
return $this; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @return bool |
191
|
|
|
*/ |
192
|
|
|
public function isResultView(): bool |
193
|
|
|
{ |
194
|
|
|
return $this->resultView; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* @param bool $resultView |
199
|
|
|
* |
200
|
|
|
* @return AccountAcl |
201
|
|
|
*/ |
202
|
|
|
public function setResultView(bool $resultView) |
203
|
|
|
{ |
204
|
|
|
$this->resultView = $resultView; |
205
|
|
|
|
206
|
|
|
return $this; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* @return bool |
211
|
|
|
*/ |
212
|
|
|
public function isResultEdit(): bool |
213
|
|
|
{ |
214
|
|
|
return $this->resultEdit; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* @param bool $resultEdit |
219
|
|
|
* |
220
|
|
|
* @return AccountAcl |
221
|
|
|
*/ |
222
|
|
|
public function setResultEdit(bool $resultEdit) |
223
|
|
|
{ |
224
|
|
|
$this->resultEdit = $resultEdit; |
225
|
|
|
|
226
|
|
|
return $this; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* @return boolean |
231
|
|
|
*/ |
232
|
|
|
public function isShowDetails(): bool |
233
|
|
|
{ |
234
|
|
|
return $this->resultView && ($this->actionId === Acl::ACCOUNT_VIEW |
235
|
|
|
|| $this->actionId === Acl::ACCOUNT_HISTORY_VIEW |
236
|
|
|
|| $this->actionId === Acl::ACCOUNT_DELETE); |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* @param bool $showDetails |
241
|
|
|
* |
242
|
|
|
* @return AccountAcl |
243
|
|
|
*/ |
244
|
|
|
public function setShowDetails(bool $showDetails) |
245
|
|
|
{ |
246
|
|
|
$this->showDetails = $showDetails; |
247
|
|
|
|
248
|
|
|
return $this; |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
/** |
252
|
|
|
* @return boolean |
253
|
|
|
*/ |
254
|
|
|
public function isShowPass(): bool |
255
|
|
|
{ |
256
|
|
|
return ($this->actionId === Acl::ACCOUNT_CREATE |
257
|
|
|
|| $this->actionId === Acl::ACCOUNT_COPY); |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* @param bool $showPass |
262
|
|
|
* |
263
|
|
|
* @return AccountAcl |
264
|
|
|
*/ |
265
|
|
|
public function setShowPass(bool $showPass) |
266
|
|
|
{ |
267
|
|
|
$this->showPass = $showPass; |
268
|
|
|
|
269
|
|
|
return $this; |
270
|
|
|
} |
271
|
|
|
|
272
|
|
|
/** |
273
|
|
|
* @return boolean |
274
|
|
|
*/ |
275
|
|
|
public function isShowFiles(): bool |
276
|
|
|
{ |
277
|
|
|
return $this->showFiles |
278
|
|
|
&& ($this->actionId === Acl::ACCOUNT_EDIT |
279
|
|
|
|| $this->actionId === Acl::ACCOUNT_VIEW |
280
|
|
|
|| $this->actionId === Acl::ACCOUNT_HISTORY_VIEW); |
281
|
|
|
} |
282
|
|
|
|
283
|
|
|
/** |
284
|
|
|
* @param bool $showFiles |
285
|
|
|
* |
286
|
|
|
* @return AccountAcl |
287
|
|
|
*/ |
288
|
|
|
public function setShowFiles(bool $showFiles) |
289
|
|
|
{ |
290
|
|
|
$this->showFiles = $this->resultView && $showFiles; |
291
|
|
|
|
292
|
|
|
return $this; |
293
|
|
|
} |
294
|
|
|
|
295
|
|
|
/** |
296
|
|
|
* @return boolean |
297
|
|
|
*/ |
298
|
|
|
public function isShowViewPass(): bool |
299
|
|
|
{ |
300
|
|
|
return $this->showViewPass |
301
|
|
|
&& ($this->actionId === Acl::ACCOUNT_SEARCH |
302
|
|
|
|| $this->actionId === Acl::ACCOUNT_VIEW |
303
|
|
|
|| $this->actionId === Acl::ACCOUNT_VIEW_PASS |
304
|
|
|
|| $this->actionId === Acl::ACCOUNT_HISTORY_VIEW |
305
|
|
|
|| $this->actionId === Acl::ACCOUNT_EDIT); |
306
|
|
|
} |
307
|
|
|
|
308
|
|
|
/** |
309
|
|
|
* @param bool $showViewPass |
310
|
|
|
* |
311
|
|
|
* @return AccountAcl |
312
|
|
|
*/ |
313
|
|
|
public function setShowViewPass(bool $showViewPass) |
314
|
|
|
{ |
315
|
|
|
$this->showViewPass = $this->resultView && $showViewPass; |
316
|
|
|
|
317
|
|
|
return $this; |
318
|
|
|
} |
319
|
|
|
|
320
|
|
|
/** |
321
|
|
|
* @return boolean |
322
|
|
|
*/ |
323
|
|
|
public function isShowSave(): bool |
324
|
|
|
{ |
325
|
|
|
return $this->actionId === Acl::ACCOUNT_EDIT |
326
|
|
|
|| $this->actionId === Acl::ACCOUNT_CREATE |
327
|
|
|
|| $this->actionId === Acl::ACCOUNT_COPY; |
328
|
|
|
} |
329
|
|
|
|
330
|
|
|
/** |
331
|
|
|
* @param bool $showSave |
332
|
|
|
* |
333
|
|
|
* @return AccountAcl |
334
|
|
|
*/ |
335
|
|
|
public function setShowSave(bool $showSave) |
336
|
|
|
{ |
337
|
|
|
$this->showSave = $showSave; |
338
|
|
|
|
339
|
|
|
return $this; |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
/** |
343
|
|
|
* @return boolean |
344
|
|
|
*/ |
345
|
|
|
public function isShowEdit(): bool |
346
|
|
|
{ |
347
|
|
|
return $this->showEdit |
348
|
|
|
&& ($this->actionId === Acl::ACCOUNT_SEARCH |
349
|
|
|
|| $this->actionId === Acl::ACCOUNT_VIEW); |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
/** |
353
|
|
|
* @param bool $showEdit |
354
|
|
|
* |
355
|
|
|
* @return AccountAcl |
356
|
|
|
*/ |
357
|
|
|
public function setShowEdit(bool $showEdit) |
358
|
|
|
{ |
359
|
|
|
$this->showEdit = $this->resultEdit && $showEdit && !$this->isHistory; |
360
|
|
|
|
361
|
|
|
return $this; |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
/** |
365
|
|
|
* @return boolean |
366
|
|
|
*/ |
367
|
|
|
public function isShowEditPass(): bool |
368
|
|
|
{ |
369
|
|
|
return $this->showEditPass |
370
|
|
|
&& ($this->actionId === Acl::ACCOUNT_EDIT |
371
|
|
|
|| $this->actionId === Acl::ACCOUNT_VIEW); |
372
|
|
|
} |
373
|
|
|
|
374
|
|
|
/** |
375
|
|
|
* @param bool $showEditPass |
376
|
|
|
* |
377
|
|
|
* @return AccountAcl |
378
|
|
|
*/ |
379
|
|
|
public function setShowEditPass(bool $showEditPass) |
380
|
|
|
{ |
381
|
|
|
$this->showEditPass = $this->resultEdit && $showEditPass && !$this->isHistory; |
382
|
|
|
|
383
|
|
|
return $this; |
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
/** |
387
|
|
|
* @return boolean |
388
|
|
|
*/ |
389
|
|
|
public function isShowDelete(): bool |
390
|
|
|
{ |
391
|
|
|
return $this->showDelete |
392
|
|
|
&& ($this->actionId === Acl::ACCOUNT_SEARCH |
393
|
|
|
|| $this->actionId === Acl::ACCOUNT_DELETE |
394
|
|
|
|| $this->actionId === Acl::ACCOUNT_EDIT); |
395
|
|
|
} |
396
|
|
|
|
397
|
|
|
/** |
398
|
|
|
* @param bool $showDelete |
399
|
|
|
* |
400
|
|
|
* @return AccountAcl |
401
|
|
|
*/ |
402
|
|
|
public function setShowDelete(bool $showDelete) |
403
|
|
|
{ |
404
|
|
|
$this->showDelete = $this->resultEdit && $showDelete; |
405
|
|
|
|
406
|
|
|
return $this; |
407
|
|
|
} |
408
|
|
|
|
409
|
|
|
/** |
410
|
|
|
* @return boolean |
411
|
|
|
*/ |
412
|
|
|
public function isShowRestore(): bool |
413
|
|
|
{ |
414
|
|
|
return $this->actionId === Acl::ACCOUNT_HISTORY_VIEW && $this->showRestore; |
415
|
|
|
} |
416
|
|
|
|
417
|
|
|
/** |
418
|
|
|
* @param bool $showRestore |
419
|
|
|
* |
420
|
|
|
* @return AccountAcl |
421
|
|
|
*/ |
422
|
|
|
public function setShowRestore(bool $showRestore) |
423
|
|
|
{ |
424
|
|
|
$this->showRestore = $this->resultEdit && $showRestore; |
425
|
|
|
|
426
|
|
|
return $this; |
427
|
|
|
} |
428
|
|
|
|
429
|
|
|
/** |
430
|
|
|
* @return boolean |
431
|
|
|
*/ |
432
|
|
|
public function isShowLink(): bool |
433
|
|
|
{ |
434
|
|
|
return $this->showLink; |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
/** |
438
|
|
|
* @param bool $showLink |
439
|
|
|
* |
440
|
|
|
* @return AccountAcl |
441
|
|
|
*/ |
442
|
|
|
public function setShowLink(bool $showLink) |
443
|
|
|
{ |
444
|
|
|
$this->showLink = $showLink; |
445
|
|
|
|
446
|
|
|
return $this; |
447
|
|
|
} |
448
|
|
|
|
449
|
|
|
/** |
450
|
|
|
* @return boolean |
451
|
|
|
*/ |
452
|
|
|
public function isShowHistory(): bool |
453
|
|
|
{ |
454
|
|
|
return $this->showHistory |
455
|
|
|
&& ($this->actionId === Acl::ACCOUNT_VIEW |
456
|
|
|
|| $this->actionId === Acl::ACCOUNT_HISTORY_VIEW); |
457
|
|
|
} |
458
|
|
|
|
459
|
|
|
/** |
460
|
|
|
* @param bool $showHistory |
461
|
|
|
* |
462
|
|
|
* @return AccountAcl |
463
|
|
|
*/ |
464
|
|
|
public function setShowHistory(bool $showHistory) |
465
|
|
|
{ |
466
|
|
|
$this->showHistory = $showHistory; |
467
|
|
|
|
468
|
|
|
return $this; |
469
|
|
|
} |
470
|
|
|
|
471
|
|
|
/** |
472
|
|
|
* @return boolean |
473
|
|
|
*/ |
474
|
|
|
public function isShow(): bool |
475
|
|
|
{ |
476
|
|
|
return ($this->showView || $this->showEdit || $this->showViewPass || $this->showCopy || $this->showDelete); |
477
|
|
|
} |
478
|
|
|
|
479
|
|
|
/** |
480
|
|
|
* @return int |
481
|
|
|
*/ |
482
|
|
|
public function getActionId(): int |
483
|
|
|
{ |
484
|
|
|
return $this->actionId; |
485
|
|
|
} |
486
|
|
|
|
487
|
|
|
/** |
488
|
|
|
* @param int $actionId |
489
|
|
|
* |
490
|
|
|
* @return AccountAcl |
491
|
|
|
*/ |
492
|
|
|
public function setActionId($actionId) |
493
|
|
|
{ |
494
|
|
|
$this->actionId = (int)$actionId; |
495
|
|
|
|
496
|
|
|
return $this; |
497
|
|
|
} |
498
|
|
|
|
499
|
|
|
/** |
500
|
|
|
* @return int |
501
|
|
|
*/ |
502
|
|
|
public function getTime(): int |
503
|
|
|
{ |
504
|
|
|
return $this->time; |
505
|
|
|
} |
506
|
|
|
|
507
|
|
|
/** |
508
|
|
|
* @param int $time |
509
|
|
|
* |
510
|
|
|
* @return AccountAcl |
511
|
|
|
*/ |
512
|
|
|
public function setTime($time) |
513
|
|
|
{ |
514
|
|
|
$this->time = (int)$time; |
515
|
|
|
|
516
|
|
|
return $this; |
517
|
|
|
} |
518
|
|
|
|
519
|
|
|
/** |
520
|
|
|
* Comprueba los permisos de acceso a una cuenta. |
521
|
|
|
* |
522
|
|
|
* @param null $actionId |
|
|
|
|
523
|
|
|
* |
524
|
|
|
* @return bool |
525
|
|
|
*/ |
526
|
|
|
public function checkAccountAccess($actionId) |
527
|
|
|
{ |
528
|
|
|
if ($this->compiledAccountAccess === false) { |
529
|
|
|
return false; |
530
|
|
|
} |
531
|
|
|
|
532
|
|
|
switch ($actionId) { |
533
|
|
|
case Acl::ACCOUNT_VIEW: |
534
|
|
|
case Acl::ACCOUNT_SEARCH: |
535
|
|
|
case Acl::ACCOUNT_VIEW_PASS: |
536
|
|
|
case Acl::ACCOUNT_HISTORY_VIEW: |
537
|
|
|
case Acl::ACCOUNT_COPY: |
538
|
|
|
return $this->resultView; |
539
|
|
|
case Acl::ACCOUNT_EDIT: |
540
|
|
|
case Acl::ACCOUNT_DELETE: |
541
|
|
|
case Acl::ACCOUNT_EDIT_PASS: |
542
|
|
|
case Acl::ACCOUNT_EDIT_RESTORE: |
543
|
|
|
return $this->resultEdit; |
544
|
|
|
default: |
545
|
|
|
return false; |
546
|
|
|
} |
547
|
|
|
} |
548
|
|
|
|
549
|
|
|
/** |
550
|
|
|
* @return boolean |
551
|
|
|
*/ |
552
|
|
|
public function isModified(): bool |
553
|
|
|
{ |
554
|
|
|
return $this->modified; |
555
|
|
|
} |
556
|
|
|
|
557
|
|
|
/** |
558
|
|
|
* @param boolean $modified |
559
|
|
|
* |
560
|
|
|
* @return AccountAcl |
561
|
|
|
*/ |
562
|
|
|
public function setModified($modified) |
563
|
|
|
{ |
564
|
|
|
$this->modified = $modified; |
565
|
|
|
|
566
|
|
|
return $this; |
567
|
|
|
} |
568
|
|
|
|
569
|
|
|
/** |
570
|
|
|
* @return boolean |
571
|
|
|
*/ |
572
|
|
|
public function isShowView(): bool |
573
|
|
|
{ |
574
|
|
|
return $this->showView; |
575
|
|
|
} |
576
|
|
|
|
577
|
|
|
/** |
578
|
|
|
* @param bool $showView |
579
|
|
|
* |
580
|
|
|
* @return AccountAcl |
581
|
|
|
*/ |
582
|
|
|
public function setShowView(bool $showView) |
583
|
|
|
{ |
584
|
|
|
$this->showView = $this->resultView && $showView; |
585
|
|
|
|
586
|
|
|
return $this; |
587
|
|
|
} |
588
|
|
|
|
589
|
|
|
/** |
590
|
|
|
* @return boolean |
591
|
|
|
*/ |
592
|
|
|
public function isShowCopy(): bool |
593
|
|
|
{ |
594
|
|
|
return $this->showCopy |
595
|
|
|
&& ($this->actionId === Acl::ACCOUNT_SEARCH |
596
|
|
|
|| $this->actionId === Acl::ACCOUNT_VIEW |
597
|
|
|
|| $this->actionId === Acl::ACCOUNT_EDIT); |
598
|
|
|
} |
599
|
|
|
|
600
|
|
|
/** |
601
|
|
|
* @param bool $showCopy |
602
|
|
|
* |
603
|
|
|
* @return AccountAcl |
604
|
|
|
*/ |
605
|
|
|
public function setShowCopy(bool $showCopy) |
606
|
|
|
{ |
607
|
|
|
$this->showCopy = $this->resultView && $showCopy; |
608
|
|
|
|
609
|
|
|
return $this; |
610
|
|
|
} |
611
|
|
|
|
612
|
|
|
/** |
613
|
|
|
* @return boolean |
614
|
|
|
*/ |
615
|
|
|
public function isShowPermission(): bool |
616
|
|
|
{ |
617
|
|
|
return $this->showPermission; |
618
|
|
|
} |
619
|
|
|
|
620
|
|
|
/** |
621
|
|
|
* @param bool $showPermission |
622
|
|
|
* |
623
|
|
|
* @return AccountAcl |
624
|
|
|
*/ |
625
|
|
|
public function setShowPermission(bool $showPermission) |
626
|
|
|
{ |
627
|
|
|
$this->showPermission = $showPermission; |
628
|
|
|
|
629
|
|
|
return $this; |
630
|
|
|
} |
631
|
|
|
|
632
|
|
|
/** |
633
|
|
|
* @return int |
634
|
|
|
*/ |
635
|
|
|
public function getAccountId(): int |
636
|
|
|
{ |
637
|
|
|
return $this->accountId; |
638
|
|
|
} |
639
|
|
|
|
640
|
|
|
/** |
641
|
|
|
* @param int $accountId |
642
|
|
|
* |
643
|
|
|
* @return AccountAcl |
644
|
|
|
*/ |
645
|
|
|
public function setAccountId($accountId) |
646
|
|
|
{ |
647
|
|
|
$this->accountId = (int)$accountId; |
648
|
|
|
|
649
|
|
|
return $this; |
650
|
|
|
} |
651
|
|
|
|
652
|
|
|
/** |
653
|
|
|
* @return bool |
654
|
|
|
*/ |
655
|
|
|
public function isHistory(): bool |
656
|
|
|
{ |
657
|
|
|
return $this->isHistory; |
658
|
|
|
} |
659
|
|
|
|
660
|
|
|
/** |
661
|
|
|
* @param bool $isHistory |
662
|
|
|
* |
663
|
|
|
* @return AccountAcl |
664
|
|
|
*/ |
665
|
|
|
public function setIsHistory(bool $isHistory) |
666
|
|
|
{ |
667
|
|
|
$this->isHistory = $isHistory; |
668
|
|
|
|
669
|
|
|
return $this; |
670
|
|
|
} |
671
|
|
|
|
672
|
|
|
/** |
673
|
|
|
* @return bool |
674
|
|
|
*/ |
675
|
|
|
public function isCompiledShowAccess(): bool |
676
|
|
|
{ |
677
|
|
|
return $this->compiledShowAccess; |
678
|
|
|
} |
679
|
|
|
|
680
|
|
|
/** |
681
|
|
|
* @param bool $compiledShowAccess |
682
|
|
|
* |
683
|
|
|
* @return AccountAcl |
684
|
|
|
*/ |
685
|
|
|
public function setCompiledShowAccess($compiledShowAccess) |
686
|
|
|
{ |
687
|
|
|
$this->compiledShowAccess = (bool)$compiledShowAccess; |
688
|
|
|
|
689
|
|
|
return $this; |
690
|
|
|
} |
691
|
|
|
|
692
|
|
|
/** |
693
|
|
|
* @return bool |
694
|
|
|
*/ |
695
|
|
|
public function isCompiledAccountAccess(): bool |
696
|
|
|
{ |
697
|
|
|
return $this->compiledAccountAccess; |
698
|
|
|
} |
699
|
|
|
|
700
|
|
|
/** |
701
|
|
|
* @param bool $compiledAccountAccess |
702
|
|
|
* |
703
|
|
|
* @return AccountAcl |
704
|
|
|
*/ |
705
|
|
|
public function setCompiledAccountAccess($compiledAccountAccess) |
706
|
|
|
{ |
707
|
|
|
$this->compiledAccountAccess = (bool)$compiledAccountAccess; |
708
|
|
|
|
709
|
|
|
return $this; |
710
|
|
|
} |
711
|
|
|
|
712
|
|
|
public function reset() |
713
|
|
|
{ |
714
|
|
|
foreach ($this as $property => $value) { |
715
|
|
|
if (strpos($property, 'show') === 0) { |
716
|
|
|
$this->{$property} = false; |
717
|
|
|
} |
718
|
|
|
} |
719
|
|
|
} |
720
|
|
|
} |