[Archivesspace_Users_Group] Also: setting groups/permissions thru backend API [was: new user defaults?]
Steven Majewski
sdm7g at virginia.edu
Wed Aug 5 20:38:44 EDT 2015
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. )
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” .
The return value from that makes it appear to have updated:
{"status":"Updated","id":13,"lock_version":3,"stale":null,"uri":"/users/13","warnings":[]}
But doing another GET shows nothing changed.
I’ve also tried appending ?groups%5B%5D=/repositories/3/groups/15 to the URL
( which should be "repository-basic-data-entry” group for that repo ) which also returns what
looks like an updated status, but again, it appears unchanged.
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:
{"error":"The record you tried to update has been modified since you fetched it."}
I haven’t yet tried posting to /repositories/$REPO/groups yet. Is that the one that works ?
Can anyone suggest a working API formula ?
— Steve.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20150805/d5064339/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4943 bytes
Desc: not available
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20150805/d5064339/attachment.bin>
More information about the Archivesspace_Users_Group
mailing list