Closed chrbox closed 5 months ago
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.
After updating all users have access to the RoleResource in the panel. There are no permissions set for the role of the user.