Skip to content
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

Public Permission without Id undeletable #22613

Closed
NilsBaumgartner1994 opened this issue May 30, 2024 · 2 comments
Closed

Public Permission without Id undeletable #22613

NilsBaumgartner1994 opened this issue May 30, 2024 · 2 comments

Comments

@NilsBaumgartner1994
Copy link
Contributor

Describe the Bug

So when i create via a fetch POST a new permission for the public role it did not have an id. This brings me to a point where i cannot delete it.

From the network inspection:

{
	"0": {
		"role": null,
		"collection": "eating_habit_templates_translations",
		"action": "read",
		"permissions": {},
		"validation": {},
		"presets": null,
		"fields": [
			"*"
		]
	},
        ....
}

How is that even possible to have a permissions object without an id?

Bildschirmfoto 2024-05-30 um 02 55 48 Bildschirmfoto 2024-05-30 um 02 56 05 Bildschirmfoto 2024-05-30 um 02 56 21

To Reproduce

Just create a permission object

const response = await fetch(`${getUrlPermissions()}`, {
            agent: httpsAgent,
            method: 'POST',
            headers: {
                "Cookie": headers.get('cookie'),
                'Content-Type': 'application/json',
            },
            body: JSON.stringify({
                role: permission.role,
                collection: permission.collection,
                action: permission.action,
                fields: permission.fields,
                permissions: permission.permissions,
                validation: permission.validation,
            }),
        });

Sadly i could not reproduce it by again. It seems to be very odd that this even exists in first place.

Directus Version

v10.11.2

Hosting Strategy

Self-Hosted (Docker Image)

Database

Postgres 13

@NilsBaumgartner1994
Copy link
Contributor Author

Seems to happen when posting a permission and setting "id" to undefined, that this kind of "soft-lock" is created.

@NilsBaumgartner1994
Copy link
Contributor Author

So investigating the knex table "directus_permissions" showed that all items had an id. So that is good to know. The problem where, that there were dublicates (same collection, action, role). This somehow lead that the frontend could not show the id.

I would suggest:

  • Remove dublicates automatically
  • Use the first item if there are more than that, in order to show users that they can delete an item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

1 participant