@@ 147-164 (lines=18) @@ | ||
144 | * |
|
145 | * @return bool |
|
146 | */ |
|
147 | protected function matchRole($rule) |
|
148 | { |
|
149 | if (empty($rule['roles'])) { |
|
150 | return true; |
|
151 | } |
|
152 | ||
153 | if (!is_array($rule['roles'])) { |
|
154 | $rule['roles'][] = $rule['roles']; |
|
155 | } |
|
156 | ||
157 | foreach ($rule['roles'] AS $role) { |
|
158 | if ($this->container->user->check($role)) { |
|
159 | return true; |
|
160 | } |
|
161 | } |
|
162 | ||
163 | return false; |
|
164 | } |
|
165 | ||
166 | /** |
|
167 | * Match IP |
|
@@ 207-225 (lines=19) @@ | ||
204 | * |
|
205 | * @return bool |
|
206 | */ |
|
207 | protected function matchVerb($rule) |
|
208 | { |
|
209 | if (empty($rule['verb'])) { |
|
210 | return true; |
|
211 | } |
|
212 | ||
213 | if (!is_array($rule['verb'])) { |
|
214 | $rule['verb'][] = $rule['verb']; |
|
215 | } |
|
216 | ||
217 | $verb = $this->container->request->getMethod(); |
|
218 | ||
219 | foreach ($rule['verb'] AS $v) { |
|
220 | if ($v === $verb) { |
|
221 | return true; |
|
222 | } |
|
223 | } |
|
224 | ||
225 | return false; |
|
226 | } |
|
227 | ||
228 | /** |