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
tutorial:adm:assign_roles_to_contract_-_import_of_data_from_csv [2019/11/12 12:37]
michalp
tutorial:adm:assign_roles_to_contract_-_import_of_data_from_csv [2023/08/02 06:25] (current)
cabelkal [Fill all attributes]
Line 1: Line 1:
 ====== Assign roles to contract EAV - Import of data from CSV ====== ====== Assign roles to contract EAV - Import of data from CSV ======
  
-This task assigns roles to contracts via selected EAV for main contract definition.+This task assigns roles to contracts. You can either assign roles to every contract of the user, to the main contract, or to a contract specified by contract EAV values.
  
 ==== Prepare CSV file ==== ==== Prepare CSV file ====
Line 8: Line 8:
  
 <code> <code>
-Username;Role;Position +login;role;eavname1;eavvalue1;eavname2;eavvalue2;roleattributename1;roleattributevalue1 
-kopr;Back Office;Business +john;role1,role2;eav1;123;eav2;321,roleAttribute,attributeValue 
-svanda;Manager;Trip Advisor+</code> 
 + 
 +As a result, this task will assign roles with the code 'role1' and 'role2' to a user with username 'john' on a contract which has the value of a contract EAV 'eav1' '123' and 'eav2' '321', if such contract exists. It will also set role attribute "roleAttribute" to value "attributeValue". Note that if no such parameter exists, import task will simply skip this and it wont fail. 
 + 
 +If you want to assign roles to the main contract or to all contracts, you only need to specify the username and the roles. 
 + 
 +<code> 
 +login;role 
 +john;role1,role2
 </code> </code>
  
-CSV file can have optional number of columns, role and eav columns are specified in setup of LRT.  
-*If you want to assign role to all user contracts, leave the contract eav value in csv empty*. 
 ==== Create new LongRunningTask ==== ==== Create new LongRunningTask ====
  
Line 23: Line 29:
 Now we need to create new LRT with these attributes: Now we need to create new LRT with these attributes:
  
-- Task type - **ImportCSVUserContractRolesTaskExecutor** +- Task type - **Import assigned roles** - Column separator - separator of columns in csv file - File encoding type - insert encoding of your csv file. Default value is UTF-8 - Upload CSV file - dropzone to select or drop csv file - Column with roles Name of the column with roles in csv file. - Column with username name of the column with username - Roles assignment contract type - Asign roles to one of the options: 
-Import csv file - dropzone to select or drop csv file + 
-- Column with username name of the column with username +   * allContracts assigns roles to all valid and future contracts 
-- Column with roles Name of the column with roles in csv file +  * primeContract - assigns roles to prime/main contract 
-Column with contract eav Name of the column with contract eav in csv file +  * eavContract - assigns roles to contract with specified EAV 
-Contract eav name - Name of the contract eav in IdM + 
-Column separator - separator of columns in csv file+- Prefix of column name with contract attribute name Prefix of column with contract eav code in the csv file. You can use any number of EAV attributes you choose, only make sure to add numbers after the prefix starting with 1. Mandatory if you choose assign to eavContract. (See the first example of a CSV file above.) Prefix of column name with contract attribute value Prefix of column with contract eav value in the csv file. You can use any number of EAV attributes you choose, only make sure to add numbers after the prefix starting with 1. Mandatory if you choose to assign to eavContract. (See the first example of a CSV file above.) Multi value separator - separator of roles column in csv file. This works ONLY for the roles column. You also need to tick the checkbox. - Contract definition - specify IdmIdentityContract definition code. Use it optionally when you choose to assign to eavContract. The default value is default. - Prefix of column with the name of the role parameter. - Prefix of column with the value of the role parameter. Optionally you can fill role validity (valid from and valid till), with this option you have to also fill date format (Example: "yyyy-MM-dd"). 
 + 
 +<note important>There is a known issue with importing unique role attributes. If the attribute is defined as unique, you need to have unique values for the attribute in your input csv file. If values are not unique, there is a possibility to create non unique values in IdM due to the asynchronous nature of role requests.</note> 
 + 
 +{{.:assignrolesfromcsv_1.jpg?nolink&597x1591|assignrolesfromcsv.jpg}}
  
-{{:tutorial:adm:screenshot_2019-06-11_at_14.23.35.png?400|}} 
  
 ==== Run the task ==== ==== Run the task ====
Line 45: Line 54:
 You can check status about created role definitions in "all tasks" panel in task detail. Here you can find information about created or already existing automatic role definitions. You can check status about created role definitions in "all tasks" panel in task detail. Here you can find information about created or already existing automatic role definitions.
  
-Everything should be set up so far and when the task ends, roles which was in IdM are assigned to contract with eav value same as in CSV.+Everything should be set up and when the task ends, roles which was in IdM are assigned to contract with eav value same as in CSV.
  
 ==== Known issues ==== ==== Known issues ====
  • by michalp