1 | <?php |
||
12 | class UserPermissionsComponent extends Component { |
||
13 | |||
14 | /** |
||
15 | * Controller name |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | public $controller = null; |
||
20 | |||
21 | /** |
||
22 | * Session |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | public $session = null; |
||
27 | |||
28 | /** |
||
29 | * Components array |
||
30 | * |
||
31 | * @var array |
||
32 | */ |
||
33 | public $components = ['Flash']; |
||
34 | |||
35 | private $actions; |
||
36 | |||
37 | private $allow; |
||
38 | |||
39 | private $redirect; |
||
40 | |||
41 | private $params; |
||
42 | |||
43 | private $message; |
||
44 | |||
45 | private $userType; |
||
46 | |||
47 | private $action; |
||
48 | |||
49 | /** |
||
50 | * Boolean value which holds the configuration for the behavior in case of |
||
51 | * missing handlers. |
||
52 | */ |
||
53 | private $throwEx; |
||
54 | |||
55 | /** |
||
56 | * Initialization to get controller variable |
||
57 | * |
||
58 | * For this component available settings: |
||
59 | * bool throwEx - default false - if set to true, an exception will be |
||
60 | * thrown, if a handler is about to be called but does not exist. |
||
61 | * |
||
62 | * @param array $config Configuration array for the component. |
||
63 | */ |
||
64 | 1 | public function initialize(array $config) |
|
80 | |||
81 | /** |
||
82 | * Initialization to get controller variable |
||
83 | * |
||
84 | * @param array $rules Array of rules for permissions. |
||
85 | * @return bool false if user / group doesn't have permission, true if has permission |
||
86 | */ |
||
87 | 1 | public function allow ($rules) { |
|
88 | 1 | $this->setUserValues(); |
|
89 | 1 | $this->bindConfiguration($rules); |
|
90 | |||
91 | if (!$this->applyGroupsRules($rules)) { |
||
92 | $this->applyViewsRules($rules); |
||
93 | } |
||
94 | |||
95 | return $this->allow; |
||
96 | } |
||
97 | |||
98 | 1 | private function setUserValues() |
|
106 | |||
107 | 1 | private function bindConfiguration(array $rules) |
|
126 | |||
127 | private function applyGroupsRules(array $rules) |
||
139 | |||
140 | private function searchForApplyGroupRules($key) |
||
150 | |||
151 | private function notInArrayAction() |
||
155 | |||
156 | private function applyViewsRules(array $rules) |
||
164 | |||
165 | private function searchForApplyViewRules($key, $value) |
||
175 | |||
176 | private function checkForHandler($controller, $handler) |
||
194 | |||
195 | private function redirectIfIsSet() |
||
206 | } |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..