bezhanSalleh / filament-shield

The easiest and most intuitive way to add access management to your Filament Admin Resources, Pages & Widgets through `spatie/laravel-permission`

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Role Resource is accessible for everyone

chrbox opened this issue · comments

After updating all users have access to the RoleResource in the panel. There are no permissions set for the role of the user.

From the config set the following key to true to enforce the policy for RoleResource, clear your config and let me know.

 'register_role_policy' => [
     'enabled' => true,
 ],

Yes, it works. It fixed the problem for me! Thank you!

If you're using Laravel 11, you can also fix it by adding this on your AppServiceProvider.php

use Spatie\Permission\Models\Role;
use App\Policies\RolePolicy;
use Illuminate\Support\Facades\Gate;

public function boot(): void
{
    Gate::policy(Role::class, RolePolicy::class);
}

If you're using Laravel 11, you can also fix it by adding this on your AppServiceProvider.php


use Spatie\Permission\Models\Role;

use App\Policies\RolePolicy;

use Illuminate\Support\Facades\Gate;



public function boot(): void

{

    Gate::policy(Role::class, RolePolicy::class);

}

You don't really need this, because its already being handled by shield. you just need to turn it on from the config.