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

User with Delete permission not able to delete testCases #11002

Open
aniketkatkar97 opened this issue Apr 11, 2023 · 6 comments
Open

User with Delete permission not able to delete testCases #11002

aniketkatkar97 opened this issue Apr 11, 2023 · 6 comments
Assignees
Labels

Comments

@aniketkatkar97
Copy link
Member

Affected module
backend

Describe the bug
A user with only Delete permission cannot delete a test case.

To Reproduce

Screen.Recording.2023-04-11.at.6.36.03.PM.mov

Request URL:: /api/v1/testCases/{id}?hardDelete=false&recursive=false
Request Method: DELETE
Response:

{
    "code": 403,
    "message": "Principal: CatalogPrincipal{name='aniket'} operations [EditTests] not allowed"
}
{
    "resource": "all",
    "permissions": [
        {
            "operation": "All",
            "access": "notAllow"
        },
        {
            "operation": "Create",
            "access": "notAllow"
        },
        {
            "operation": "Delete",
            "access": "allow",
            "rule": {
                "name": "TestRule",
                "description": "",
                "effect": "allow",
                "operations": [
                    "Delete"
                ],
                "resources": [
                    "All"
                ]
            },
            "policy": "DataStewardPolicy",
            "role": "DataSteward"
        },
        ...
    ]
}

Expected behavior
A clear and concise description of what you expected to happen.

Version:

  • OS: [e.g. iOS]
  • Python version:
  • OpenMetadata version: [e.g. 0.8]
  • OpenMetadata Ingestion package version: [e.g. openmetadata-ingestion[docker]==XYZ]

Additional context
Add any other context about the problem here.

@harshach harshach removed this from Release 1.0 Apr 25, 2023
@harshach harshach moved this to APIs & Backend in Release 1.1 May 8, 2023
@harshach harshach moved this from APIs & Backend to Roles & Policies in Release 1.1 May 8, 2023
@harshach
Copy link
Collaborator

@ShaileshParmar11 @TeddyCr
user with following policies are unable to view the tests
image
image

As admin

image

@TeddyCr
Copy link
Contributor

TeddyCr commented Aug 9, 2023

@harshach regarding what you mentioned I believe this comes from the list test suite operation context being linked to the table resource (and not a test resource per say).

...
    OperationContext operationContext = new OperationContext(Entity.TABLE, MetadataOperation.VIEW_TESTS);
...

I believe if your user does not have view permission tables then no test suites will be returned.

As far as the user not being able to delete tests with the DELETE permission it looks like the DELETE request uses the EDIT_TESTS. Any more info why we used this one instead of the DELETE one?

@harshach
Copy link
Collaborator

We need to be consistent in the transitive permissions
Example

  1. Service Creation means one should be able to create Ingestion Pipeine related to service
  2. Table's EditTests means they should be able to Edit/Delete the test that's belongs to the table

Not all entities are top-level entities and deriving it from the main parent/container makes sense.
So this means we shouldn't be showing the derived/child entities in Resources Section and its clear to the user all these permissions are being in affect from Table rather than Test's Delete

@TeddyCr
Copy link
Contributor

TeddyCr commented Aug 17, 2023

@harshach thanks for this explaination. I am not sure I fully understand what is required next based on what you mentioned. Could you give a bit more details?

@harshach harshach assigned harshach and unassigned TeddyCr Aug 17, 2023
@harshach
Copy link
Collaborator

@TeddyCr assigned it to myself. I'll cleanup as part of a PR I am working on

@pmbrull
Copy link
Collaborator

pmbrull commented Oct 19, 2023

@harshach was this done?

@harshach harshach assigned sureshms and unassigned harshach Oct 22, 2023
@harshach harshach moved this to Backend - Bugs & Minor Features in Release 1.3.0 Oct 22, 2023
@harshach harshach assigned harshach and unassigned sureshms Dec 1, 2023
@harshach harshach removed this from Release 1.3.0 Jan 19, 2024
@harshach harshach moved this to Backend - Bugs & Minor Features in Release 1.4.0 Jan 26, 2024
@harshach harshach removed this from Release 1.4.0 Jan 26, 2024
@harshach harshach moved this to Backend - Bugs & Minor Features in Release 1.4.0 Mar 11, 2024
@harshach harshach removed this from Release 1.4.0 May 2, 2024
@harshach harshach moved this to Backend - Bugs & Minor Features in Release 1.4.1 May 2, 2024
@harshach harshach removed this from Release 1.4.1 Jun 23, 2024
@harshach harshach moved this to Backend - Bugs & Minor Features in Release 1.7.0 Dec 12, 2024
@harshach harshach removed this from Release 1.7.0 Dec 14, 2024
@harshach harshach moved this to Platform in Release 1.6.2 Dec 14, 2024
@harshach harshach changed the title Backend: user with Delete permission not able to delete testCases User with Delete permission not able to delete testCases Dec 14, 2024
@harshach harshach moved this from Platform to In Progress in Release 1.6.2 Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Progress
Development

No branches or pull requests

6 participants