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

Promote Changes to QA - 2/11/2020 #202

Merged
merged 27 commits into from
Feb 12, 2020
Merged

Promote Changes to QA - 2/11/2020 #202

merged 27 commits into from
Feb 12, 2020

Conversation

coderbydesign
Copy link
Contributor

@coderbydesign coderbydesign commented Feb 11, 2020

Brings the following PRs into stable to move from CI to QA:

#190 - Update testing to allow for nonadmin and start RonR removal
#191 - Shows error when proxy encounter exception
#192 - Add migration aimed at removing RBAC on RBAC roles
#193 - Add data migration to remove default seeded roles
#195 - Remove default limit on /access/ requests
#197 - Add access count to /roles/ and /roles/<uuid>/ endpoints
#198 - Add role access GET endpoint: /roles//access/
#205 - Add settings for smoke test run

wcmitchell and others added 24 commits January 16, 2020 16:59
When proxy returns error, it was not considered. e.g. when the threre is connection
error, the program just shows 200 to customer.
Shows error when proxy encounter exception
Update testing to allow for nonadmin and start RonR removal
Signed-off-by: Chris Mitchell <[email protected]>
Add migration aimed at removing RBAC on RBAC roles
In order to not make system and/or platform_default roles available or enforced
for applications not integrating with the GA rollout of RBAC, we need to remove
these roles from the seed files for the following apps:

- ansible-automation
- ansible-hub
- catalog
- remediations
- sources
- subscriptions

Other apps not needing default roles are:

- inventory
- approval
- sources
- cost-management

However at the time, we don't have default roles for those apps, so we don't need
to take any action.

A dependent PR has been added to the [RBAC config repo](RedHatInsights/rbac-config#17)
to remove these roles from the seed files. That will need to be merged and rolled
out before this PR can be merged.
Add data migration to remove default seeded roles
In order to prevent default enforcement of pagination on the `/access/` endpoint,
this will remove the default limit (currently 10) from `/access/` requests, while
keeping it on all other endpoints.

When we get the paginator for the request, we'll now check to see if the `?limit`
query parameter is sent in the request. If so, we'll continue to respect pagination
on the request, and return a paginated response. If `?limit` does not exist in
the request, we will not set a paginator, which in tern will supply the raw
queryset to the serializer.

In order to keep a consistent API payload with and without pagination, we need to
explicitly return the serialized data nested under a `data` object.

**With Pagination:**
_/api/rbac/v1/access/?application=ansible-automation&limit=20_
```
{
  "meta": {
    "count": 1,
    "limit": 20,
    "offset": 0
  },
  "links": {
    "first": "/api/rbac/v1/access/?application=ansible-automation&limit=20&offset=0",
    "next": null,
    "previous": null,
    "last": "/api/rbac/v1/access/?application=ansible-automation&limit=20&offset=0"
  },
  "data": [
    {
      "permission": "ansible-automation:*:*",
      "resourceDefinitions": []
    }
  ]
}
```

**Without Pagination:**
_/api/rbac/v1/access/?application=ansible-automation_
```
{
  "data": [
    {
      "permission": "ansible-automation:*:*",
      "resourceDefinitions": []
    }
  ]
}
```
We now have two different possible 200 responses for `/access/`, one with pagination,
and one without.

OpenAPI 3 supports the use of `anyOf` and `oneOf` for response body schemas [1].
This updates the spec to reflect those possible responses (with and without
pagination), and includes examples of each.

[1] https://swagger.io/docs/specification/describing-responses/
…cess

Remove default `limit` on `/access/` requests
…oles-endpoint

Add access count to `/roles/` and `/roles/<uuid>/` endpoints
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.
Add role access GET endpoint: /roles/<uuid>/access/
astrozzc
astrozzc previously approved these changes Feb 11, 2020
wcmitchell
wcmitchell previously approved these changes Feb 11, 2020
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.

👍

@coderbydesign coderbydesign merged commit 5e79962 into stable Feb 12, 2020
lpichler pushed a commit that referenced this pull request Nov 8, 2023
Add Malware Detection application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants