Project

General

Profile

Actions

Task #1713

closed

Add task to assign roles to contract via EAV attribute value (IdM extras)

Added by Petr Hanák almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Petr Hanák
Target version:
-
Start date:
06/10/2019
Due date:
% Done:

100%

Estimated time:
Owner:

Description

Create LRT for role assignment to contract via EAV attribute value.
If there is no value in csv specified, task will assign role to all contracts of user.
This task is already used on CHMI, but needs some editing and add settings to be useful in extras module.

LRT parameters:
Dropzone for file import
Column with username
Column with roles
Column with contract EAV
Name of contract EAV to search contracts


Files

001.png (92.4 KB) 001.png Ondřej Kopr, 09/09/2019 08:49 AM
same.png (67.4 KB) same.png Ondřej Kopr, 09/10/2019 06:30 AM
Actions #2

Updated by Petr Hanák over 4 years ago

  • Status changed from New to Needs feedback
  • Assignee changed from Petr Hanák to Alena Peterová

I finished tests.
I'm testing lrt counter, number of assigned roles and if the right role is assigned to right contract.
Commit:
https://github.com/bcvsolutions/czechidm-extras/commit/54768d3c4fc47d337fd039096fc25b794983bdbb

Actions #3

Updated by Petr Hanák over 4 years ago

  • Status changed from Needs feedback to In Progress
  • Assignee changed from Alena Peterová to Petr Hanák
Actions #4

Updated by Petr Hanák over 4 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Petr Hanák to Alena Peterová
Actions #5

Updated by Alena Peterová over 4 years ago

  • Project changed from IdStory Identity Manager to extras
  • Category deleted (Long running task)
Actions #6

Updated by Ondřej Kopr over 4 years ago

  • Assignee changed from Alena Peterová to Ondřej Kopr
Actions #7

Updated by Ondřej Kopr over 4 years ago

  • File 001.png 001.png added
  • Status changed from Needs feedback to In Progress
  • Assignee changed from Ondřej Kopr to Petr Hanák
  • % Done changed from 90 to 80

I merged develop into your branch, resolved conflicts and then push you branch to develop.

There is review:

  • local and jenkins tests doesn't pass maybe some problem with reused identity
  • missing author,
  • missing localization for error messages,
  • javadoc for some public method missing (not required),
  • get eav value for contract is called twice on same place (performance problem), ImportCSVUserContractRolesTaskExecutor#205 and ImportCSVUserContractRolesTaskExecutor#206,
  • EAVs is get only from default definition is this problem?
  • some small typo error in log messages (taskCompleted("Asfsigned roles: " + ge),
  • add more tests, for example ImportCSVUserContractRolesTaskExecutor.java has only 0.9% coverage (tests didn't pass), your whole branch has 6.1% test coverage,
  • fix your bugs from sonar (for example issues with Booleans),
  • unused imports,
  • useless get query for contract ImportCSVUserContractRolesTaskExecutor#173 (performance problem), (identityContractService.get(contractId)),
  • if more contracts has same EAV value, you return random of them ImportCSVUserContractRolesTaskExecutor#208 is this problem?,
  • you create useless empty role request while run this task again and again, please add checking for empty concepts and then create role request.

I tested you task and it works correctly without problem. Roles are assigned correctly, Good job! Please try fix tests and check coverage.

Actions #8

Updated by Petr Hanák over 4 years ago

Ondřej Kopr wrote:

I merged develop into your branch, resolved conflicts and then push you branch to develop.

There is review:

  • local and jenkins tests doesn't pass maybe some problem with reused identity

Solved by changing identity username.

  • missing author

There was missing author in test file, so I completed it.

  • missing localization for error messages

- Don't know how this works

  • javadoc for some public method missing (not required)

Filled for method getOneValue() in ImportCSVUserContractRolesTaskExecutor

  • get eav value for contract is called twice on same place (performance problem), ImportCSVUserContractRolesTaskExecutor#205 and ImportCSVUserContractRolesTaskExecutor#206

- Fixed but needs testing

  • EAVs is get only from default definition is this problem?

- Not sure what this mean, but it should probably check all contracts

  • some small typo error in log messages (taskCompleted("Asfsigned roles: " + ge),

I did file search in all projects but I can't find this typo.. probably created during review.

  • add more tests, for example ImportCSVUserContractRolesTaskExecutor.java has only 0.9% coverage (tests didn't pass), your whole branch has 6.1% test coverage,

- Have to find how to display this coverage

  • fix your bugs from sonar (for example issues with Booleans)

- I have to install Sonarqube and check how this works

  • unused imports

- I can't see any unused imports in ImportCSVUserContractRolesTaskExecutor and ImportCSVUserContractRolesTaskExecutorTest, but maybe Eclipse doesn't show it right

  • useless get query for contract ImportCSVUserContractRolesTaskExecutor#173 (performance problem), (identityContractService.get(contractId))

- Not sure how to do it, cause I can't log this item to LRT without existing contract

  • if more contracts has same EAV value, you return random of them ImportCSVUserContractRolesTaskExecutor#208 is this problem?

- Thats a good point, I will try to fix this.

  • you create useless empty role request while run this task again and again, please add checking for empty concepts and then create role request.

- I will fix this.

I tested you task and it works correctly without problem. Roles are assigned correctly, Good job! Please try fix tests and check coverage.

Actions #9

Updated by Ondřej Kopr over 4 years ago

Petr Hanák wrote:

There was missing author in test file, so I completed it.

Class CSVToIdM.java isn't in tests.

- Don't know how this works

There is tutorial: https://wiki.czechidm.com/tutorial/dev/module_result_code

- Not sure what this mean, but it should probably check all contracts

You search contracts EAV only by default form definition. When you have some another definition with your EAV you didn't find the contract. But is this problem?

I did file search in all projects but I can't find this typo.. probably created during review.

Probably yes, thank you for check this.

- Have to find how to display this coverage

https://sonar.bcvsolutions.eu/component_measures/metric/new_coverage/list?id=eu.bcvsolutions.idm%3Aczechidm-extras

- I have to install Sonarqube and check how this works

There is online version: https://sonar.bcvsolutions.eu/component_issues?id=eu.bcvsolutions.idm%3Aczechidm-extras#resolved=false|types=BUG

- I can't see any unused imports in ImportCSVUserContractRolesTaskExecutor and ImportCSVUserContractRolesTaskExecutorTest, but maybe Eclipse doesn't show it right

I find you some unused import in ImportRolesFromCSVExecutor. And you are the one of autor. So sorry I will send message to original autor.

- Not sure how to do it, cause I can't log this item to LRT without existing contract

Hmm, the contract is probably same as you get some lines before, see:

Actions #10

Updated by Petr Hanák over 4 years ago

Ondřej Kopr wrote:

Petr Hanák wrote:

There was missing author in test file, so I completed it.

Class CSVToIdM.java isn't in tests.

OK.

Add localizations for errors

added localizations for COLUMN_NOT_FOUND, EMPTY_ATTACHMENT_ID.

- Not sure what this mean, but it should probably check all contracts

You search contracts EAV only by default form definition. When you have some another definition with your EAV, you didn't find the contract. But is this problem?

No, from HR we always sync. values to main contract definition. I've added this info to wiki for this LRT.

Test coverage

Now almost everything is covered (except form attributes definition)

fix your bugs from sonar (for example issues with Booleans)

Fixed bugs.

if more contracts has same EAV value, you return random of them ImportCSVUserContractRolesTaskExecutor#208 is this problem?

After consulting with Alena, role is now assigned to all contracts with matching eav

you create useless empty role request while run this task again and again, please add checking for empty concepts and then create role request.

Fixed.

Actions #11

Updated by Ondřej Kopr over 4 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 80 to 100

Review for feature was done. Thanks for it.

Actions #12

Updated by Ondřej Kopr over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF