Conditions | 5 |
Paths | 5 |
Total Lines | 19 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
51 | 44 | protected function isAllowed($item) |
|
52 | { |
||
53 | // Check if there are any permission defined for the item. |
||
54 | |||
55 | 44 | if (empty($item['can'])) { |
|
56 | 41 | return true; |
|
57 | } |
||
58 | |||
59 | // Read the extra arguments (a db model instance can be used). |
||
60 | |||
61 | 5 | $args = isset($item['model']) ? $item['model'] : []; |
|
62 | |||
63 | // Check if the current user can perform the configured permissions. |
||
64 | |||
65 | 5 | if (is_string($item['can']) || is_array($item['can'])) { |
|
66 | 4 | return $this->gate->any($item['can'], $args); |
|
67 | } |
||
68 | |||
69 | 1 | return true; |
|
70 | } |
||
72 |