kiritokatklian / nova-permission

A Laravel Nova tool for Spatie's laravel-permission library
https://novapackages.com/packages/vyuldashev/nova-permission
MIT License
68 stars 15 forks source link

No data permissions #20

Closed KickSchutte67 closed 2 years ago

KickSchutte67 commented 2 years ago

Hey! I am currently using this package to represent any permissions attached to a user.

On localhost, the permissions are visible and editable.

image

When I am deploying my localhost to a dev environment, the PermissionBooleanGroup gives me a "No Data".

image

Do you have any idea what is going wrong here?

kiritokatklian commented 2 years ago

My guess is that the permissions aren't being fetched from the database. Can you see if the permissions being sent via the network inspector?

KickSchutte67 commented 2 years ago
image

These are the ones that are loaded, I am not 100% sure the permissions are fetched (I personally think not).

kiritokatklian commented 2 years ago

Look at the response of 784?relationshipType= (third one from the top). It should contain a JSON of resources -> fields -> [field of permissions] -> value.

KickSchutte67 commented 2 years ago
image

This is the right one I suppose.

kiritokatklian commented 2 years ago

Yeah, it's this one. The value key has an empty array, so it's not fetching the permissions from the database.

Does the main permissions index page load the permissions?

KickSchutte67 commented 2 years ago

For some reason the permissions do load when providing the \Vyuldashev\NovaPermission\NovaPermissionTool::make(), inside the tools() array. It is weird, since this was not necessary on the local environment yesterday. I guess the issue has been fixed now. Thanks for the fast responses!

KickSchutte67 commented 2 years ago

One note. When enabling a policy for the permissions, I keep getting the "No Data" issue. Is there a way to keep loading the permissions while a policy is enabled to stop the users from accessing the index of permissions?

Edited after:

When using the PermissionPolicy, the policy must return true on the view() policy function. Is there a way to return false on the view() policy function and still load in the permissions? In my use case, users aren't allowed to attach users via this resource and only on the user resource itself. Due to the permissions still being visible, users can attach and detach users from it.