| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2.0185 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | protected function checkPermission(User $user, $description) |
||
| 15 | 76 | { |
|
| 16 | $allowed = UserRolePermissions::whereRoleId($user->role_id)->whereHas('UserRolePermissionTypes', function($q) use ($description) |
||
| 17 | 76 | { |
|
| 18 | 76 | $q->where('description', $description); |
|
| 19 | })->first(); |
||
| 20 | 76 | ||
| 21 | Log::channel('auth')->debug('User '.$user->username.' is trying to get permission for '.$description.'. Result - '.$allowed); |
||
| 22 | 76 | if($allowed) |
|
| 23 | { |
||
| 24 | return $allowed->allow; |
||
| 25 | } |
||
| 26 | |||
| 27 | return false; |
||
| 28 | } |
||
| 30 |