fix: Use flexible type check for is_admin authorization gate
Change strict equality check (=== true) to loose check that works with both integer 1 and boolean true values.
This commit is contained in:
@@ -33,8 +33,8 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
// Authorization gates
|
// Authorization gates
|
||||||
\Illuminate\Support\Facades\Gate::define('access-ops', function ($user) {
|
\Illuminate\Support\Facades\Gate::define('access-ops', function ($user) {
|
||||||
// Allow admin users to access ops
|
// Allow admin users to access ops (flexible type check)
|
||||||
return $user->is_admin === true;
|
return $user && $user->is_admin;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user