Table of Contents

Roles - Import of data from CSV

1. Prepare the CSV file

Here is an example of a CSV file which can be used for importing (or updating) roles, setting their role attributes, guarantees (by user, or by role) and criticality, for saving them in a created catalogue and for assigning their subordinate role. To use this CSV file, create a new identity with user name "user-login", and a new role with code "role_code" to set guarantees. Have a virtual system called 'test'.

roles;code;description;attribute;guarantees;guarantee_type;guarantee_role;guarantee_role_type;criticality;catalogue;subroles;eavcode1;eavvalue1;systemname1;systemattr1;systemvalue1
testimportrolename;testimportrolecode;desc;attr1;user-login;;role_code;;4;cat1|cat3;;eav;value;test;rights;testimportrolename

In Excel, it looks like this:

As you can see roles column can contain single or multiple values (separated by a line; the separator can be specified in the settings of the LRT). For multivalued roles, values from the same row will be added to every role. The only exception here is role criticality which cannot be multivalued. CSV file can have optional number of columns: column names are specified in setup of LRT.

The result of this LRT used with this CSV file should be that one new role testimportrolename (with code testimportrolecode) will be created. It will have these properties:

CzechIdM uses by defaul utf-8 encoding. If your input file is encoded in diferent encoding, or if you experience some issues with non english characters, you may set different encoding in configuration of import long running task. Examples of other used encodings might be windows-1250, utf-8 or windows-1252

Create new LongRunningTask

Now we will create the new LongRunningTask (LRT). As shown in the picture, go to Settings → Task scheduler → Scheduled tasks and hit green "Add" button to add new LRT. Select the task Import roles from CSV. (ImportRolesFromCSVExecutor)

Fill all attributes

Now we need to create new LRT with these attributes:

General:

Role attributes:

Role EAVs:

You can set value to multiple role EAVs. The mechanism used for this is prefixes which are followed by the order number of the column (e. g., 'eavcode1', where 'eavcode' is the prefix and '1' the order number). The combination of the prefix and the number identifies a column uniquely.

Guarantees:

System:

You can set attributes at multiple systems or set multiple attributes in one system. The mechanism used for this is prefixes which are followed by the order number of the column (e. g., 'systemname1', where 'systemname' is the prefix and '1' the order number). The combination of the prefix and the number identifies a column uniquely.

Since module version 15.1.0, you can configure columns for parameters that specify the selection of mapping for linking a role to a system. All of these parameters are optional:

The entity type and account type act as filters for available mappings. The system selects the first mapping returned by the filter (if multiple mappings match, one is selected essentially at random). The flag for account creation then defines the specific behavior for that link; in previous versions, the default behavior was always used, where the role automatically creates an account on the system.

For example, consider the following import file:

name;code;system1;roleCreatesAccount1;accountType1;entityType1;system2;roleCreatesAccount2;accountType2;entityType2
My role;my-role;Some system;Yes;PERSONAL;IDENTITY;Other system;false;PERSONAL_OTHER;IDENTITY

Set the folowing:

Then, the import

  1. will create a role with the name 'My role' and the code 'my-role'
  2. will connect the role with system Some system via provisioning mapping of personal accounts and role assignment will create account on system
  3. will connect the role with system Other system via provisioning mapping of other personal accounts and role assignment won't create account on system
If you are updating the roles, make sure to set the same form definition the role already have (if they have any). Also, each role can only have one definition, so if you by mistake set a different definition in the LRT configuration, you will likely get an error. Generally, DO NOT use this LRT to change the definition of a role. You can only change the definition if the role has no attributes set yet. Supports update (the current value of the attribute will be overwritten if imported).
System attribute values currently do NOT support ":" (colon) character. If the value contains a colon, the whole string after the colon is ignored.
This LRT can be used to update existing values but it does not remove old values. The only overwritten values during update are role criticality, description and MemberOf attribute value. They will be changed only if they are not empty in the CSV file

lrt_roles_import.jpg

Run the task

Now we need to hit run.

Now we must go to the "all tasks" panel, select the newly created LRT (check the checkbox), click Operation with selected record and Run selected task.

You can also check the status of the created roles there in the task detail. Here you can find information about roles created, updated, or already existing.

At this point, everything should be set up and when the task ends, roles are imported in IdM with their attributes and other imported values, and placed in the catalogue named by the system name.

Known issues

If you delete or upload new file via dropzone, you should delete old files, created from previous uploads.