Defect #3132
closedDuplicate adding roles for role composition
100%
Description
Use case: In our project exists automatic role that has several subroles and we had two role requests that added same automatic roles for same user . Both was created in about 10 second - resave same user.
In both role request exists adding same automatic role. The first role request was added the role and the second correctly evaluated that automatic role was added in previous role request:
2022-06-06T10:29:37.049125+02:00[Europe/Prague]: Request change in concept [ba86fe1e-6e2a-4208-bfad-4e37e502d8c4], was not executed, because requested automatic role was already assigned (not from this role request)!
but in second role request was added subroles by the automatic role that was removed from role request and this is wrong behavior!
The wrong added subroles has filled role role composition without directed role and filled valid till and valid from.
Updated by Roman Kučera over 2 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
I am able to replicate this issue on local env, when I have the same user in two tabs and quickly hit save from both tabs. Hitting save two times in same tab does not cause this issue.
I probably found the place, where to fix it.
Updated by Roman Kučera over 2 years ago
- % Done changed from 10 to 80
Fix implemented in https://github.com/bcvsolutions/CzechIdMng/tree/kucerar/3132-duplicate-sub-roles-for-parent-auto-role
all tests were executed, waiting for result. Test passed
Port for 10 LTS should be just cherry pick of commit as the method looks the same
Updated by Roman Kučera over 2 years ago
- % Done changed from 80 to 90
I did some more testing and change the solution, because if some sub role was in deeper level not just directly under automatic role, previous fix doesn't work.
Now it works correctly even for this use case
Setup of roles, role "1" is automatic
|-- 1 |--2 |--3 |--4
Updated by Roman Kučera over 2 years ago
- Status changed from In Progress to Needs feedback
- Assignee changed from Roman Kučera to Tomáš Doischer
https://github.com/bcvsolutions/CzechIdMng/pull/223
@doischert Can you make a review please?
Updated by Roman Kučera over 2 years ago
Added test for new code.
Before fix, test would fail, after fix it pass
Updated by Tomáš Doischer over 2 years ago
- Status changed from Needs feedback to In Progress
- Assignee changed from Tomáš Doischer to Roman Kučera
- Target version set to 13.0.0
LGTM, merged to develop. Thank you for the fix and the test.
Can you also prepare a PR to a new LTS branch?
Updated by Roman Kučera over 2 years ago
PR for 10LTS https://github.com/bcvsolutions/CzechIdMng/pull/224
Updated by Tomáš Doischer over 2 years ago
- Status changed from In Progress to Resolved
- % Done changed from 90 to 100
Thank you!
Updated by Tomáš Doischer almost 2 years ago
- Status changed from Resolved to Closed