Defect #3132
closed
Duplicate adding roles for role composition
Added by Ondřej Kopr over 2 years ago.
Updated almost 2 years ago.
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.
- 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.
- % Done changed from 10 to 80
- % 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
- Status changed from In Progress to Needs feedback
- Assignee changed from Roman Kučera to Tomáš Doischer
Added test for new code.
Before fix, test would fail, after fix it pass
- 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?
- Status changed from In Progress to Resolved
- % Done changed from 90 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF