-
Notifications
You must be signed in to change notification settings - Fork 165
Closed
Labels
Description
Would you consider adding a config item that allows to enable a default role to protect the admin middleware easily.
I have this by:
vendor/backpack/base/src/app/Http/Middleware/Admin.php
Adding [21:23}
if (!Auth::User()->hasRole('Administrators')) {
return redirect()->guest(config('backpack.base.route_prefix', 'admin').'/login');
}
This hardcodes it, but wrapping it in something like:
if (config('backpack.base.route_role) !== false) {
if (!Auth::User()->hasRole(config('backpack.base.route_role))) {
return redirect()->guest(config('backpack.base.route_prefix', 'admin').'/login');
}
}
In the base you can set this to false. You can even add another IF clause checking if the permission manager is even installed