bezhanSalleh / filament-shield

The easiest and most intuitive way to add access management to your Filament Admin Resources, Pages & Widgets through `spatie/laravel-permission`

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

super_admin role generation

artjom opened this issue · comments

commented

hey,

thanks for the great work!
It seems, there's a logic error for the super_admin role creation.
If the super_admin is disabled it still creates the super admin role, whenever a new policy is generated.

protected static function giveSuperAdminPermission(string | array | Collection $permissions): void { if (! Utils::isSuperAdminDefinedViaGate()) { $superAdmin = static::createRole(); $superAdmin->givePermissionTo($permissions); app(PermissionRegistrar::class)->forgetCachedPermissions(); } }

In my case, I don't need the super admin role at all, so I deactivated it in the config file. Still the role is added every time I'm generating a policy.