Bug 737567 - REST API - Updating the users list in a role object doesn't work as expected
Summary: REST API - Updating the users list in a role object doesn't work as expected
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 0.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Bryan Kearney
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-12 15:07 UTC by Amos Benari
Modified: 2015-05-14 16:04 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-20 19:47:01 UTC


Attachments (Terms of Use)

Description Amos Benari 2011-09-12 15:07:36 UTC
Description of problem:
When updating the users list in a Role object, the role doesn't get updated.

Steps to Reproduce:
1. Get a role object
2. Update the role
3. send PUT "/candlepin/roles/<role_id>"
  
Actual results:
200 OK. No actual change to the users list in the role

Expected results:
200 OK. An update to the users list in the role.

Additional info:
a workaround exists, calling:
POST roles/{role_id}/users/{username}
DELETE roles/{role_id}/users/{username}
for each addition and removal from the list.

Comment 1 Devan Goodwin 2011-12-20 19:47:01 UTC
Going to close as I believe this is working as designed, in general with the API we tried to avoid anything that introduces race conditions. In this case you would be looking up the whole list of users so you could add in the one you want. The data could change between the time you lookup the list of users and when you submit the PUT, which could clobber whoever made the action in between. Instead we tried to add explicit API calls for adding/removing to collections like this. 

I will update the documentation for PUT /roles/{roleId} to clarify this, currently only updating the role name is supported.


Note You need to log in before you can comment on or make changes to this bug.