Setting user permissions programmatically

LabKey Support Forum (Inactive)
Setting user permissions programmatically Matthew Bellew  2012-09-08 13:53
Status: Closed
 
Sorry, I should have given a little more direction. Not enough coffee...

The way you add permissions is not by editing users, but b y editing security policies. You get the policy for the current container using

LABKEY.Security.getPolicy(config)

see https://www.labkey.org/download/clientapi_docs/javascript-
api/symbols/LABKEY.SecurityPolicy.html

Then you can grant or remove roles to users/groups .

   addRoleAssignment(principalId, role)
   clearRoleAssignments(principalId)

then use

LABKEY.Security.savePolicy(config)