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

Add role access GET endpoint: /roles/<uuid>/access/ #198

Merged

Conversation

coderbydesign
Copy link
Contributor

This add the GET endpoint: /roles/<uuid>/access/ to the API. While the access objects are currently returned as a nested resource within /roles/<uuid>/, the UI is requesting that we provide an explicit endpoint for retrieving access objects for a given role, in order to paginate and eventually filter on this data directly.

The payload will look like:

{
  "meta": {
    "count": 2,
    "limit": 10,
    "offset": 0
  },
  "links": {
    "first": "/api/rbac/v1/roles/3ecac858-4f48-4393-a26b-914ba73477aa/access/?limit=10&offset=0",
    "next": null,
    "previous": null,
    "last": "/api/rbac/v1/roles/3ecac858-4f48-4393-a26b-914ba73477aa/access/?limit=10&offset=0"
  },
  "data": [
    {
      "permission": "inventory:*:*",
      "resourceDefinitions": []
    },
    {
      "permission": "ansible-automation:*:*",
      "resourceDefinitions": []
    }
  ]
}

And is represented in the openapi.json spec:
Screen Shot 2020-02-06 at 10 15 37 AM

Currently there is no filtering on this endpoint, only pagination.

To support the front-end RBAC efforts, we're adding an endpoint which returns the
serialized access objects for a given role.

The response for a valid role will return a paginated payload such as:

```
{
  "meta": {
    "count": 2,
    "limit": 10,
    "offset": 0
  },
  "links": {
    "first": "/api/rbac/v1/roles/3ecac858-4f48-4393-a26b-914ba73477aa/access/?limit=10&offset=0",
    "next": null,
    "previous": null,
    "last": "/api/rbac/v1/roles/3ecac858-4f48-4393-a26b-914ba73477aa/access/?limit=10&offset=0"
  },
  "data": [
    {
      "permission": "inventory:*:*",
      "resourceDefinitions": []
    },
    {
      "permission": "ansible-automation:*:*",
      "resourceDefinitions": []
    }
  ]
}
```

The response for an invalid/non-existent role will return a 404.
@coderbydesign coderbydesign changed the title Add role access get endpoint Add role access GET endpoint: /roles/<uuid>/access/ Feb 6, 2020
Copy link
Contributor

@astrozzc astrozzc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just have a small comment

Copy link
Contributor

@wcmitchell wcmitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@coderbydesign coderbydesign merged commit 8cd6128 into RedHatInsights:master Feb 11, 2020
@coderbydesign coderbydesign deleted the add-role-access-get-endpoint branch February 11, 2020 13:23
lpichler pushed a commit that referenced this pull request Nov 8, 2023
Add OCP Advisor roles and permissions for qa env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants