Closed Bamux closed 1 year ago
https://github.com/serenysoft/nova-permissions#database-seeding
what if we have custom names and your seeder is not suitable for us?
The seeder is an example only. You should modify as you see fit
The seeder is an example only. You should modify as you see fit
you have integrated check for:
There is no permission named `viewAnyRole` for guard `web`.
There is no permission named `updateRole` for guard `web`
https://nova.laravel.com/docs/4.0/resources/authorization.html
Its package predefined policies, I want change them.
can you make optional?
NovaPermissions.php
Gate::policy(config('permission.models.permission'), $this->permissionPolicy);
Gate::policy(config('permission.models.role'), $this->rolePolicy);
registering new classes in provider doesn't override them
Does not make sense to do it. It's only include these permissions in your Seeder
Please see: https://github.com/serenysoft/nova-permissions/commit/d617b844036fd6618cec4e871a354c3a2e519d94
Does not make sense to do it. It's only include these permissions in your Seeder
Please see: d617b84
I wanted to overite PermissionPolicy
to return false in all methods. You defined it in NovaPermissions.php
and AuthServiceProvider
can't overide it. I found another solution to override you file, but it would be nice to turn off it in package config
if you don't want the permissions to be available, use disablePermissions()
https://github.com/serenysoft/nova-permissions#customizations
if you don't want the permissions to be available, use
disablePermissions()
https://github.com/serenysoft/nova-permissions#customizations
I want use custom policies instead of yours
NovaPermissions.php
if($enabled) {
Gate::policy(config('permission.models.permission'), $this->permissionPolicy);
Gate::policy(config('permission.models.role'), $this->rolePolicy);
}
@arturasfrontit Our solution was using a Role Policy and the default Nova way with canSeeWhen.
public function tools(): array
{
return [
\Sereny\NovaPermissions\NovaPermissions::make()
->hideFieldsFromPermission(['group'])
->canSeeWhen('viewAnyRole', User::class),
];
}
@leandrogehlen Consider to make this the default. Or at least if there is not viewAnyRole in the permission table. because it is not documented that this is necessary.
I have a fresh Laravel (v10.1.5 with PHP v8.2.0) installation, including Nova. I can also successfully log into the Nova backend. When I follow your installation instructions step by step and then try to log into the Nova backend, I get the following error message.
Spatie\Permission\Exceptions\PermissionDoesNotExist There is no permission named
viewAnyRole
for guardweb
.https://flareapp.io/share/W7zRa0k7#F94
Do you have any idea what could be causing this?