-
Notifications
You must be signed in to change notification settings - Fork 432
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 response body to add-member API #9188
base: main
Are you sure you want to change the base?
Conversation
d064db2
to
2ebfb06
Compare
I think the
...will get a 404 Not Found response. As will this:
...but both requests would succeed if they were authenticated with The reason is that the This is in the API docs too. Add member is documented as requiring authclient authentication. Whereas delete member is documented as requiring an API key. (Edit-member isn't documented yet.) The API for getting a list of the group's members will do the same thing if you call it with an authclient:
...this will return Maybe we'll want to do something about this one day--the fact that the add-member API only works for authclients not for users, get-group-members works with either, and edit-member and remove-member only work for users. |
@@ -895,8 +897,12 @@ paths: | |||
- $ref: '#/components/parameters/GroupID' | |||
- $ref: '#/components/parameters/UserID' | |||
responses: | |||
'204': | |||
$ref: '#/components/responses/NoContent' | |||
'200': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is a significant change to the API but in practice I don't think clients will check for 204 in particular (vs any other 2XX code).
Change the add-group-membership API's response from a 204 No Content to a 200 OK with a JSON representation of the added membership as the body. Fixes #9141
2ebfb06
to
c649dc9
Compare
Removed the docs changes from this PR, gonna do them in #9210 instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 5 changed files in this pull request and generated no suggestions.
Comments skipped due to low confidence (2)
tests/functional/api/groups/members_test.py:360
- [nitpick] The parameter names
pubid
anduserid
are ambiguous. Consider renaming them togroup_pubid
anduser_userid
for clarity.
def do_request(pubid=group.pubid, userid=user.userid, status=200):
tests/unit/h/views/api/group_members_test.py:144
- Ensure the test covers the new behavior of returning a JSON response with status code 200.
def test_it(self, pyramid_request, group_members_service, context):
Change the add-group-membership API's response from a 204 No Content to a 200 OK with a JSON representation of the newly-added membership as the body.
Fixes #9141.
Testing:
Log in as
devdata_admin
Go to http://localhost:5000/groups/new and create a new group
Go to http://localhost:5000/admin/oauthclients/new and create an authclient with these properties:
Authority: localhost
Grant type: client_credentials
Trusted: yes
Use the authclient to authenticate an API request to add
devdata_user
to the group: