Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
tutorial:adm:roles_-_import_data_from_csv [2020/07/02 11:09]
doischert
tutorial:adm:roles_-_import_data_from_csv [2020/08/11 12:25]
doischert
Line 3: Line 3:
 ==== 1. Prepare the CSV file ==== ==== 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 <nowiki>"user_login"</nowiki>, and a new role with code <nowiki>"role_code"</nowiki> to set guarantees.+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 <nowiki>"user_login"</nowiki>, and a new role with code <nowiki>"role_code"</nowiki> to set guarantees. Have a virtual system called 'test'.
  
 <code> <code>
-roles;code;description;attribute;guarantees;guarantee_type;guarantee_role;guarantee_role_type;criticality;catalogue;subroles;eav_info;system_info +roles;code;description;attribute;guarantees;guarantee_type;guarantee_role;guarantee_role_type;criticality;catalogue;subroles;eavcode1;eavvalue1;systemname1;systemattr1;systemvalue1 
-Manager-A;Manager-A;Leader;;;;;;;;role_code;attribute:DSF17+testimportrolename;testimportrolecode;desc;attr1;user-login;;role_code;;4;cat1|cat3;;eav;value;test;rights;testimportrolename
-LAY-SP;LAY-SP;Manager;attr1;user-login;type1;role_code;type2;3;cat4;;;virtual:rights:role.one.value +
-"CORE-CLOSE +
-AB-role";;desc;attr1;;;;;2;"cat1 +
-cat3";;;+
 </code> </code>
  
Line 20: Line 16:
 CSV file can have optional number of columns: column names are specified in setup of LRT. 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+The result of this LRT used with this CSV file should be that one new role testimportrolename (with code testimportrolecodewill be createdIt will have these properties: 
-  * 4 new roles <nowiki>(Manager-A, LAY-SP, CORE-CLOSE, AB-role).</nowiki> +  * description: 'desc' 
-  * <nowiki>Manager-A will have a description set (Leader),a subrole set (role_code), and an EAV attribute "attribute" set with value "DSF17".</nowiki> +  * attribute: 'attr1
-  * <nowiki>LAY-SP will have a description (Manager), attribute (attr1), criticality (3), guarantee by identity (with user-name "user-login" and type of guarantee "type1"), and guarantee by role (with role-code "role_code" and type of guarantee "type2") set. It will be saved in catalogue cat4. It will create account in system "virtual" and fill the attribute "rights" with value "role.one.value".</nowiki> +  * guarantee: user with username 'user-login
-  * Roles CORE-CLOSE and AB-role will have a description (desc), an attribute (attr1), and criticality (2) set. They will be in catalogues cat1 and cat3.+  * guarantee by role: role with the code 'role_code
 +  * criticality:
 +  * catalogue: it will be in 'cat1' and 'cat3' 
 +  * it will have EAV with code 'eav' with value 'value' 
 +  * it will create an account on system 'test' and set value of attribute 'rights' to 'testimportrolename'
  
 <note important>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</note> <note important>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</note>
Line 48: Line 48:
 - Column with subrole codes - name of the column with subordinate roles codes, can be also used to update subordinate roles (if your CSV file doesn't contain subordinate roles codes, i.e., you are not setting subordinate roles for any of your roles, leave this line empty) - Column with subrole codes - name of the column with subordinate roles codes, can be also used to update subordinate roles (if your CSV file doesn't contain subordinate roles codes, i.e., you are not setting subordinate roles for any of your roles, leave this line empty)
 - Column separator - separator of columns in csv file (default ; ) - Column separator - separator of columns in csv file (default ; )
-- Multi value separator - (Char, default: new line) separator of multi valued role names in the csv file, new line separator is default export from excel, but for better clarity of the csv file, it's recommended to use some symbol instead+- Multi value separator - (Char, default: |) separator of multi valued role names in the csv file, new line separator is default export from excel, but for better clarity of the csv file, it's recommended to use some symbol instead
 - Role environment - the name of the environment to which you want to add the role; only supported during creating, not updating roles! - Role environment - the name of the environment to which you want to add the role; only supported during creating, not updating roles!
 - Can be requested - (Boolean) - Roles can be requested, can be also used to update already imported settings; it allows not selecting value when updating (not when creating!) roles which will not change the Can be requested property of roles. When creating roles, either Yes or No must be selected. - Can be requested - (Boolean) - Roles can be requested, can be also used to update already imported settings; it allows not selecting value when updating (not when creating!) roles which will not change the Can be requested property of roles. When creating roles, either Yes or No must be selected.
Line 59: Line 59:
 **Role EAVs:** **Role EAVs:**
  
-- Column with EAV attribute codes and values: name of the column with role EAVs codes and valuesseparate the code and the values by ':', eg"attribute_code:attribute_value"Only attributes from the main role definition can be imported and they must of type SHORTTEXT. Can be multivalued. Supports update (the current value of the attribute will be overwritten if imported).+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 '1the order number)The combination of the prefix and the number identifies a column uniquely 
 +- Prefix of column with name of EAV attribute: Only attributes from the main role definition can be imported and they must of type SHORTTEXT. Supports update (the current value of the attribute will be overwritten if imported).  
 +- Prefix of column with value of EAV attribute
  
 **Guarantees:** **Guarantees:**
Line 71: Line 73:
  
 **System:** **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.  
-- Column with system informations (name of the systemattributeits value) - name of column with the name of the system, imported attributes and its value is, separate the system name, attribute code and the value by ':', e. g. "AD:ldapGroups:BCV_all"The attribute has to a multivalued attribute with merge strategy set.+Prefix of column with system name 
 +- Prefix of column with system attribute codes 
 +- Prefix of column with system attribute values: The attribute has to a multivalued attribute with merge strategy set.
  
 <note important>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).</note> <note important>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).</note>
Line 78: Line 82:
 <note>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</note> <note>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</note>
  
-{{ :tutorial:adm:lrt.png?nolink |}}+{{ :tutorial:adm:lrt_roles_import.jpg?nolink |}}
  
 ==== Run the task ==== ==== Run the task ====
  • by apeterova