ahulme

Batch System Role Assignments for Nodes

Blog Post created by ahulme on Jul 20, 2018

Challenge:  Batch assigning users to Admin roles within Nodes.  When you take advantage of the Community systems Learning Context Hierarchy it can be time consuming to assign many users roles is each node.  This was a challenge for Queen Margret University and  Joe Currie talked to us at TLC in Manchester on Dev Day to see if we had a better way.

 

Solution:  I have created a very simple B2 to help with this task.   This B2 adds a new system Admin tool.

Batch Node Admin Roles 

 

 

 

 

 

 

Copy and paste Pipe separated List of User and Roles with the Node Batch UID. This currently only supports one role per user per Node. Use a carriage return for each new user record. The format is user name|Node Batch UID|role name e.g. fflintstone|68555d7b-6445-43b0-a5e1-dd794d0ce2f1|User Administrator

 

Example:

 

AH1|3875808e-9a59-4ae7-8782-be9961a40b5f|User Administrator

AH2|3875808e-9a59-4ae7-8782-be9961a40b5f|User Administrator

AH3|3875808e-9a59-4ae7-8782-be9961a40b5f|User Administrator

AH4|3875808e-9a59-4ae7-8782-be9961a40b5f|User Administrator

AH5|3875808e-9a59-4ae7-8782-be9961a40b5f|User Administrator

AH6|3875808e-9a59-4ae7-8782-be9961a40b5f|User Administrator

 

Technical Details:

 

The B2 is based from the fabulous temple B23 form the All the Ducks Team.  GitHub - AllTheDucks/atd-b2-stub: Building Block template project

 

The Node manager does all the hard work for you.  Load in the Node ID a user list and a role list.

 

NodeManagerImpl n = new NodeManagerImpl();
n.addNodeAdmins(getnodeinfo.getNodeId(), userlist, rolelist);

 

Limitations:  Only one role can be assigned via this tool at the moment per user per node.  If a user already has a role this will be removed and updated with the new role.

 

Going Forward: I am happy to share the B2 or the code with anyone who wants to test or modify this project.  There is plenty of scope for improvements and I hope this will be made redundant in future as our REST API's get more mature and feature rich.

 

Outcomes