Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Zebedeu opened this issue Apr 5, 2024 · 1 comment

Comments

@Zebedeu
Copy link

Zebedeu commented Apr 5, 2024

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.

@drbyte
Copy link
Collaborator

drbyte commented Apr 5, 2024

It's been a long time since I used the stancl/tenancy package. From what I recall this package works fine with it. So it's likely something else in your application that is overriding this package.

Please provide a minimal demo application, including the stancl/tenancy package and sufficient seeder, which replicates this problem so we can investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants