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
Cannot get ids of permissions for a custom role. #21965
Comments
I don't know I have problems to open the permissions per collection.. if it is "custom" the popup closes immediately? When it is not the same issue I will file a new one:
|
May or may not be related, but we had this kind of behavior during creation/deletion of permissions via REST. It will happen after creating a second permission on the same role, collection, and action. We're on 10.10.4. To replicate:
So we now have two permissions on the same role, collection and action. But when you fetch the perms for that collection and action, you may only get one object back, and the ID will be undefined:
In GUI, the permission.id will be undefined and DirectusApp will throw. You'll see /roles/[role_id]/undefined The solution for us was to delete the old permission before posting the new permission. We used to delete the old permission after creating the new one, so rollback was a bit easier. Honestly fine with this situation. Happy to be disallowed from creating more than one permission on a role, collection, and action. Figured we were in the minority running migrations this way. |
Thanks for your hints.. We definitely also remove and add permissions. Anyway it seems for me a bug when the order is important how to do things. Update: Seems to be that I remove the perm before I added. I also get in the UI a forbidden message when I change from custom to complete permissions. |
Yup, no problem. If the permission is corrupted by having permission.id === undefined, then you may get Forbidden errors in GUI when trying to do All / None permissions assignment on that collection/action. I don't know how to recover a permission from that state right now. If you find out, please share! |
Well I have a productive instance from where I can always copy a working database. So I was not able to find the issue yet.. Seems that one of the functions are breaking the ids but I don't found how. What is kind of weird that I get a number as an ID back when I insert instead of it should be a guid..? |
directus_permissions.id are auto-incremented integers by default. They've been talking about migrating all collections to uuids, but not sure whether or when that's been implemented. |
You are right...I set ENV to log level trace but when I am executing my functions there are no deeper logs, what queries are executed in the background. Makes it hard to debug or what we might doing wrong, because the UI works correctly. |
Hi. I had a similar issue with my project. The permissions were messed up, and it appears that I created duplicate permissions using the REST API. Unfortunately, once a permission is duplicated, there is no way to retrieve its It seems that Directus is merging permissions and excluding fields that are not equal, such as I have made a helper for this case: More details: https://github.com/tractr/directus-sync#remove-permission-duplicates |
Describe the Bug
The endpoints
GET /permissions
andSEARCH /permissions
returns empty payload when requesting for theid
field only.When requesting for all fields, it works as expected.
This may be related to #21542
To Reproduce
10.10.0
to10.10.4
).id
of this new role.SEARCH http://localhost:8055/permissions
The response body is :
{ "data": [ {} ] }
If we request for the
collection
field, it seems to de-duplicate the items in the response.SEARCH http://localhost:8055/permissions
The response body is :
Even if there is 26 permissions in total.
Directus Version
v10.10.0
Hosting Strategy
Self-Hosted (Docker Image)
The text was updated successfully, but these errors were encountered: