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

Permissions Dublicate - Fix #22618

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

Permissions Dublicate - Fix #22618

NilsBaumgartner1994 opened this issue May 30, 2024 · 3 comments

Comments

@NilsBaumgartner1994
Copy link
Contributor

Describe the Improvement

So based on this issue: #22613

When having dublicates of permissions no ID is shown in the frontend, leaving users in a "soft-lock".

Tiny tweak:

  • Include a small script which auto removes dublicate entries. Maybe remove older dublicates.
  • Show in the UI frontend one of the Ids please
  • In the get permissions show the id also
@br41nslug
Copy link
Member

Can you show reproduction steps for how to get into the state of having duplicated permissions in the first place?

@NilsBaumgartner1994
Copy link
Contributor Author

See the isse #22613 by using the REST API. The issue was found since a script ran and added the same role, collection and action twice.
Also the same problem is already mentioned in: #21965
https://github.com/tractr/directus-sync?tab=readme-ov-file#remove-permission-duplicates

I think it would be better to close the issue here and mention it in the original #21965 as of duplicate.

This way two permissions are created resulting in the soft lock state, as mentioned in the issue referenced.

const response = await fetch(`http://127.0.0.1/api/permissions`, {
            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,
            }),
        });

@br41nslug
Copy link
Member

br41nslug commented May 30, 2024

Closing this in favor of #21965 the optimal solution here would be to prevent duplicate permissions instead of deduplicating them after the fact (that should be done as a one time fix)

@br41nslug br41nslug closed this as not planned Won't fix, can't repro, duplicate, stale May 30, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests

2 participants