Total Complexity | 7 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class UserFilter extends Filter |
||
14 | { |
||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | public $checkedAttribute; |
||
19 | /** |
||
20 | * @var array|string |
||
21 | */ |
||
22 | public $users; |
||
23 | /** |
||
24 | * @var IdentityInterface|null |
||
25 | */ |
||
26 | protected $identity; |
||
27 | |||
28 | /** |
||
29 | * @inheritdoc |
||
30 | */ |
||
31 | public function init() |
||
32 | { |
||
33 | if (Yii::$app->user->identity instanceof IdentityInterface) { |
||
34 | $this->identity = Yii::$app->user->identity; |
||
35 | } |
||
36 | if (is_string($this->users)) { |
||
37 | $this->users = [$this->users]; |
||
38 | } |
||
39 | parent::init(); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return bool |
||
44 | */ |
||
45 | public function isAllowed() |
||
51 | } |
||
52 | } |
||
53 |