laravel-permission icon indicating copy to clipboard operation
laravel-permission copied to clipboard

Problem with denied access using the middleware aliases role, permission, and role_or_permission in Spatie Permission version 6 and higher.

Open Zebedeu opened this issue 10 months ago • 1 comments

I am facing an issue with the middleware aliases 'role', 'permission', and 'role_or_permission' in Spatie Permission version 6 and higher. I am using Laravel 10 along with the stancl/tenancy package. The problem is that even when the user does not have the necessary permissions, access continues to be allowed instead of being denied.

Steps to reproduce the issue:

  1. I installed Spatie Permission version 6.0 or higher and the stancl/tenancy package in my Laravel 10 project.
  2. I correctly configured Spatie Permission and created the necessary permissions and roles.
  3. I used the middleware aliases 'role', 'permission', and 'role_or_permission' in my routes to restrict access based on permissions and roles.
  4. Even when the user does not have the necessary permissions or roles, access is being allowed instead of being denied.

Expected: I expected that when using the middleware aliases 'role', 'permission', and 'role_or_permission', access would be correctly denied when the user does not have the necessary permissions or roles.

Current: Currently, even when the user does not have the necessary permissions or roles, access is being allowed instead of being denied.

Zebedeu avatar Apr 05 '24 18:04 Zebedeu