Project

General

Profile

Actions

Task #2270

closed

Add option to ImportRolesFromCSVExecutor to specify column for MemberOf attribute value

Added by Roman Kučera almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Peter Štrunc
Target version:
Start date:
05/25/2020
Due date:
% Done:

100%

Estimated time:
Owner:

Description

Now if you specify MemberOf attribute if you want to import role with some system and role attribute, this LRT will set name of the role as return value for the attribute.
This behavior is not very useful and universal, because in a lot of cases this value is different from role name in IdM.

Add new parameter into LRT config to specify which column in .csv contains values for this attribute.


Related issues

Blocks extras - Task #2274: Refactor ImportRolesFromCSVExecutor and CSVToIdMClosedPeter Štrunc05/26/2020

Actions
Actions #1

Updated by Roman Kučera almost 4 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 80

Implementation in branch https://github.com/bcvsolutions/czechidm-extras/tree/2270-value-of-memberOf-import
This feature is backward compatible. If you don't specify the new parameter this LRT will behave as before.
Added test for new feature.
Doc updated, I'll add new screenshot later to.

Actions #2

Updated by Tomáš Doischer almost 4 years ago

I checked the code and tried the feature, it works great.

As for the code, on line 472 there is

long count = roleSystemService.count(roleSystemFilter, null);

the null is not needed there (it shows warning for me).

Please update the documentation: replace the screenshot and maybe add the new column to the detail of the data at the beginning of the tutorial. Also, there is a "warning" in the documentation "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 and description.". Since this feature works in the same way as description, it should be mentioned there.

Otherwise, it's great. Thank you.

Actions #3

Updated by Roman Kučera almost 4 years ago

  • % Done changed from 80 to 90

Thx for review.
I removed the null parameter.
Documentation now contains new screenshot with setting which is up to date. I added new column into example csv and edited the warning box.

Actions #4

Updated by Peter Štrunc almost 4 years ago

  • Target version changed from 2.3.0 to 2.4.0
Actions #5

Updated by Peter Štrunc almost 4 years ago

  • Blocks Task #2274: Refactor ImportRolesFromCSVExecutor and CSVToIdM added
Actions #6

Updated by Peter Štrunc almost 4 years ago

It looks good. @kucerar could you please refactor

if(hasMemberOf) {
                String transformationScript;
                if (hasMemberOfValue) {
                    transformationScript = MessageFormat.format("\"{0}\"", memberOfValues.get(roleName));
                } else {
                    transformationScript = MessageFormat.format("\"{0}\"", roleName);
                }
                roleSystemAttributeService.addRoleMappingAttribute(system.getId(), role.getId(), memberOfAttribute, transformationScript, OBJECT_CLASSNAME);

this block of code, which is used twice, into one method? Then i will merge it to develop. Thanks

Actions #7

Updated by Roman Kučera almost 4 years ago

  • Assignee changed from Roman Kučera to Peter Štrunc

I did refactor as you advised.
Please check the changes https://github.com/bcvsolutions/czechidm-extras/commit/b915b5fcc5a53f5869ddc6b27e39f5865198f47c
Thx for feedback and merge.

Actions #8

Updated by Peter Štrunc almost 4 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100
Actions

Also available in: Atom PDF