Actions
Defect #42106
openMember roles are incorrectly added when a user's memberships are updated
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
Member roles are incorrectly added when a user's memberships are updated on the user's Projects tab.
Setup:- 2 Roles: R1 and R2
- 2 Groups: G1 and G2
- G1 has role R1
- G2 has roles R1 and R2
- User is in groups G1 and G2
➔ that means the user has two inherited roles: R1 inherited by G1 and G2, and R2 inherited by G2
- On the user's Projects tab click on Edit and then on Save without changing any checkboxes
- Remove the user from G1 and G2
Expected result: The user no longer has any roles.
Actual result: The user still has the role R1.
Reason: When the user's memberships are saved, any roles inherited by more than one group are added as non-inherited roles.
Solution: Fix Member#role_ids=
:
def role_ids=(arg) ids = (arg || []).collect(&:to_i) - [0] # Keep inherited roles - ids += member_roles.select {|mr| !mr.inherited_from.nil?}.collect(&:role_id) + ids |= member_roles.select {|mr| !mr.inherited_from.nil?}.collect(&:role_id)
Files
Actions