tutorial:adm:import_automatic_roles_on_tree_nodes

Automatic roles on tree nodes - import data from CSV

This tool is a part of the Extras module.

The LRT ImportAutomaticRoleForTreeNodeFromCSVExecutor allows you to import automatic roles which will use tree nodes in their rules. All you need is to have some tree nodes and roles in your environment.

Let's prepare a sample CSV file:

nodename;nodeid;rolecode;recursion
one;;role2;UP
two;;role2;UP

Before you start, create two sample organization units (tree nodes):

  1. Name: Organization One, code: one
  2. Name: Organization Two, code: two

Then create one role with the code "role2" and name "role2".

Go to Settings>Task scheduler>Scheduled task and click the green button Add. Select ImportAutomaticRoleForTreeNodeFromCSVExecutor. Configure the Task parameters.

  • Import csv file: Use the drop-zone to select the CSV file for your import.
  • Column with node codes: Specify in which column of the CSV file the tree node codes are. This is required.
  • Column with node IDs: Specify in which column of the CSV file the node IDs are. This is quite literally the UUID of the tree node and it is used only if the tree node cannot be found using its code.
  • Column with role codes: Specify in which column of the CSV file the codes of the roles for which you are creating the automatic role are. This is required.
  • Column with recursion type: Specify in which column of the CSV file the recursion types for each automatic role are. You can set different recursion types for your automatic roles. The possible values in the CSV file are 'DOWN' (Down by the structure), 'UP' (Up by the structure), and 'NO' (Without recursion). If you leave this empty or if a line in the CSV file has no recursion type specified, the default Without recursion is used. Make sure to use a capital version in your CSV (e. g., 'UP', not 'up')
  • Column separator: Specify which character is used to separate the columns in the CSV file. Default is ';'. This is required.

Finally, click Save and run the task using the green arrow.

Now, you should see that two automatic roles were created:

  • Automatic roles cannot be updated (not even manually). This task checks if the automatic role you are importing already exists and if it does, it will not create a new one.
  • The recalculation of the automatic roles on tree nodes is done automatically and cannot be switched off. That means that once you import the roles, they will be assigned to those who are in the respective tree nodes. Be very careful with this. Is is advised to set all connected systems as Read only (with provisioning queue), esp. if you are importing a large number of automatic roles or if you are importing the roles in the production environment.