<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">OK: I found a formula that seems to work. </div><div class=""><br class=""></div><div class="">I also found that the clue as to why modifying permissions in the POST /users API method didn’t work is in the schema docs (if you click ‘view source’), where the permissions attribute of user is marked: “readonly”: true .</div><div class=""><br class=""></div><div class="">However, passing the groups URI as a parameter string also didn’t work.</div><div class=""><br class=""></div><div class="">And it still seems rather misleading that those API calls returned a status of “Updated” with “warnings”:[]. A warning would seem appropriate here (if possible).</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Also, I’ld still like to know if there is a way to set default permissions for new users. </div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">The working method:</div><div class=""><br class=""></div><div class="">If $UU = a list of usernames already created in AS: [ “user1”, “user2”, “user3” … ] </div><div class="">and /repositories/5/group/28 = "group_code": "repository-viewers", "description": "Viewers of the workspace repository” … </div><div class=""><br class=""></div><div class="">This retrieves JSON for that group and adds the list of usernames to the JSON:</div><div class=""><br class=""></div><div class="">GG=$(curl_as_osx admin pwd <a href="http://localhost:8089/repositories/5/groups/28" class="">http://localhost:8089/repositories/5/groups/28</a> | jq " .member_usernames = $UU")</div><div class=""><br class=""></div><div class="">And posts the modified JSON to the backend:</div><div class=""><br class=""></div><div class="">curl_as_osx -d "$GG" admin pwd <a href="http://localhost:8089/repositories/5/groups/28" class="">http://localhost:8089/repositories/5/groups/28</a> </div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Now retrieving the group JSON from the backend shows the updated users, and going to the “Manage User Access” page for that repository now shows that group checked for each the users. </div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">— Steve Majewski</div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 5, 2015, at 8:38 PM, Steven Majewski <<a href="mailto:sdm7g@virginia.edu" class="">sdm7g@virginia.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">I would like to use the backend API to set user permissions to avoid a couple hundred mouse clicks on the admin web forms. ( Adding users to a group seems to require you add them one at a time. It would be nicer if you could paste a list of user ids into that field and click Add just once. Or maybe put everything in a checkbox matrix so you can set several user/repo/groups/permissions at once. ) </div><div class=""><br class=""></div><div class="">I’ve tried doing a "GET /users/$ID” , pulling the permissions out of one user as a template and merging those permissions into another users json with jq, and posting again to "POST /users/$ID” . </div><div class=""><br class=""></div><div class="">The return value from that makes it appear to have updated:</div><div class=""><div style="margin: 0px; font-size: 15px; background-color: rgb(255, 238, 219);" class="">{"status":"Updated","id":13,"lock_version":3,"stale":null,"uri":"/users/13","warnings":[]}</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">But doing another GET shows nothing changed. </div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I’ve also tried appending <span style="font-size: 15px; background-color: rgb(255, 238, 219);" class="">?groups%5B%5D=/repositories/3/groups/15 </span>to the URL </div><div class="">( which should be "repository-basic-data-entry” group for that repo ) which also returns what</div><div class="">looks like an updated status, but again, it appears unchanged. </div><div class=""><br class=""></div><div class="">In both cases, *something* got updated, if only the modification date, because if I do the same operation a second time using the same JSON, it rejects the 2nd attempt with:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 15px; background-color: rgb(255, 238, 219);" class="">{"error":"The record you tried to update has been modified since you fetched it."}</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I haven’t yet tried posting to /repositories/$REPO/groups yet. Is that the one that works ?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Can anyone suggest a working API formula ? </div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">— Steve. </div></div></div></blockquote></div><br class=""></body></html>