| Conditions | 4 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function isPermissionInRoles($permission, array $roles) |
||
| 31 | { |
||
| 32 | $hasPermission = false; |
||
| 33 | |||
| 34 | foreach ($roles as $roleName) { |
||
| 35 | /** @var \Eloyekunle\PermissionsBundle\Model\Role $role */ |
||
| 36 | $role = $this->findRoleBy(['name' => $roleName]); |
||
| 37 | |||
| 38 | if ($role->isSuperAdmin() || $role->hasPermission($permission)) { |
||
| 39 | $hasPermission = true; |
||
| 40 | break; |
||
| 41 | } |
||
| 42 | } |
||
| 43 | |||
| 44 | return $hasPermission; |
||
| 45 | } |
||
| 47 |