[WIP] Allow filtering of Role Assignment lists by ansible_id #379
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, we added
ansible_id
anduser_ansible_id
as strictly writable fields (also same for team) for assigning a role to a user.This bakes this relationship into the models so that a client can use it to filter the entries, like:
Filtering:
http://127.0.0.1:8000/api/v1/role_user_assignments/?resource__ansible_id=c2b44764-3deb-4daf-a6cc-d2476cab6fbc
And again, the writable fields are:
TODO: the
user
andteam
fields should be blank/null, and the screenshot shows that's not working.So we will move away from
object_ansible_id
(which is a UUID/string field) and towards theresource
field which is relational. With this, more things will "just work".This was not done before, because generalized filtering wasn't implemented at that time, and I thought "resource" was confusing. But now this PR matches the already-implemented general filtering. FYI @newswangerd . In other words, compare to:
http://127.0.0.1:8000/api/v1/organizations/?resource__ansible_id=c2b44764-3deb-4daf-a6cc-d2476cab6fbc
This URL discovers the object that the assignment applies to. Importantly, for the API contract, it uses the same query string.