generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
As of v1.5, If you have a role with a guard other than 'web', the permissions created through that role are still given the guard of 'web'.
This issue isn't present in v1.4.
class AuditorRole extends DefinedRole
{
/** @var array|string[] */
protected array $guards = [
'admin'
];
/**
* List of enumerated permissions for the `admin` guard
*
* @return array
*/
public function admin(): array
{
return [
...AuditAbility::cases()
];
}
}
will create all permissions in the database with 'guard_name' of 'web' still. Then it errors during the 'SyncDefinedRoles' job because the permission with the guard_name of 'admin' doesn't exist.
How to reproduce the bug
Create a role without a web guard, and set it permissions.
Run the rbac:reset command.
Package Version
1.5.0
PHP Version
8.4.12
Laravel Version
12.31.1
Which operating systems does with happen with?
Linux
Notes
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working