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

Can't define "Super User" for each guard #2682

Open
pintend opened this issue Jun 17, 2024 · 0 comments
Open

Can't define "Super User" for each guard #2682

pintend opened this issue Jun 17, 2024 · 0 comments

Comments

@pintend
Copy link

pintend commented Jun 17, 2024

Description

when using multiple guards you cant define a "super user" for each guard because the before callback doesnt know what the guard is.

The guard is removed from the arguments here https://github.com/spatie/laravel-permission/blob/c99dca701d60e1a2d1f839c9bfd102b8098432fe/src/PermissionRegistrar.php#L126C26-L126C37

This might be necessary when an application has different admin portals and a user can be a super admin in one portal and not the other.

This would be a breaking change...

Steps To Reproduce

  1. create a Gate::before callback with 3 arguments, (Authorizable $user, string $ability, array $args = [])
  2. call Gate::authorize($permission, $guard)

Callback $args will be an empty array

Example Application

No response

Version of spatie/laravel-permission package:

6.7.0

Version of laravel/framework package:

n/a

PHP version:

n/a

Database engine and version:

No response

OS: Windows/Mac/Linux version:

No response

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

1 participant