Conditions | 5 |
Paths | 8 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function hasAllowedRole($accountId, $operation) |
||
18 | { |
||
19 | $operationAllowedRoles = $this->getRolesByOperation($operation); |
||
20 | $accountRoles = AuthManager::getAccountManager()->getRole($accountId) ?: []; |
||
21 | |||
22 | if ($operationAllowedRoles === null) { |
||
23 | return AuthManager::isDefaultAllow(); |
||
24 | } |
||
25 | |||
26 | foreach ($accountRoles as $role) { |
||
27 | if (in_array($role, $operationAllowedRoles) === true) { |
||
28 | return true; |
||
29 | } |
||
30 | } |
||
31 | |||
32 | return false; |
||
33 | } |
||
34 | } |
||
35 |