Bug 737567

Summary: REST API - Updating the users list in a role object doesn't work as expected
Product: [Community] Candlepin Reporter: Amos Benari <abenari>
Component: candlepinAssignee: Bryan Kearney <bkearney>
Status: CLOSED WONTFIX QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.5CC: dgoodwin, ohadlevy
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-20 19:47:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.