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

bug: Users should not be given the option to add enums to restricted namespaces #4474

Open
ogenstad opened this issue Sep 27, 2024 · 2 comments
Labels
group/frontend Issue related to the frontend (React) type/bug Something isn't working as expected

Comments

@ogenstad
Copy link
Contributor

Component

Frontend UI

Infrahub version

v1.0.0-dev0

Current Behavior

When a user visits an object that has an enum they are given the option to add or remove options. However this shouldn't be allowed if the user comes from a restricted namespace such as "Core"

Here is an example of "CoreObjectPermission":

Screenshot 2024-09-27 at 13 28 19

The "Add Option" button should not be there for restricted namespaces.

If the user tries to add something an error is returned from the backend:

Screenshot 2024-09-27 at 13 31 39

Expected Behavior

This action should not be presented for users for objects in a restricted namespace. The frontend can see this information within the schema.

Steps to Reproduce

1 Go to the Permissions
2. Edit a CoreObjectPermission
3. Select "actions"
4. Note that "Add option" is available

Additional Information

No response

@ogenstad ogenstad added type/bug Something isn't working as expected group/frontend Issue related to the frontend (React) labels Sep 27, 2024
@bilalabbad
Copy link
Contributor

Hey thanks for the details. With schema endpoint /api/schema, we have access to namespace data like:

  "namespaces": [
    {
      "name": "Core",
      "user_editable": false
    },
    {
      "name": "Builtin",
      "user_editable": true
    },
    ...

What you call restricted namespace are namespace with "user_editable": false right?

@dgarros
Copy link
Collaborator

dgarros commented Sep 30, 2024

Ideally I think we should fix this issue with the new permissions metadata at the attribute level
this way the frontend doesn't have to do anything special

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/frontend Issue related to the frontend (React) type/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

3 participants