uccellolabs /
uccello
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Uccello\Core\Http\Middleware; |
||
| 4 | |||
| 5 | use Closure; |
||
| 6 | use Auth; |
||
| 7 | |||
| 8 | class CheckSettingsPanel |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Check if the user can access to the settings panel or redirect to 403 page. |
||
| 12 | * |
||
| 13 | * @param \Illuminate\Http\Request $request |
||
| 14 | * @param \Closure $next |
||
| 15 | * @return mixed |
||
| 16 | * @throws \Symfony\Component\HttpKernel\Exception\HttpException |
||
| 17 | */ |
||
| 18 | public function handle($request, Closure $next) |
||
| 19 | { |
||
| 20 | $user = Auth::user(); |
||
| 21 | |||
| 22 | $domain = $request->domain; |
||
| 23 | |||
| 24 | if (!$user->canAccessToSettingsPanel($domain)) { |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 25 | return abort(403); |
||
|
0 ignored issues
–
show
Are you sure the usage of
abort(403) is correct as it seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 26 | } |
||
| 27 | |||
| 28 | return $next($request); |
||
| 29 | } |
||
| 30 | } |
||
| 31 |