New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #24318: Existing deleted user managed by file cannot be reactivated #5435
Conversation
case k if zombies.get(k).map(u => u.status == UserStatus.Deleted && u.managedBy == origin).getOrElse(false) => | ||
( | ||
k, | ||
zombies(k) | ||
.modify(_.status) | ||
.setTo(UserStatus.Active) | ||
.modify(_.statusHistory) | ||
.using(StatusHistory(UserStatus.Active, trace) :: _) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if there is a more elegant way, instead of having zombies.get(k)
then zombies(k)
later...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the condition below and pattern match on get(K) in place of having a guard. Iirc it's similar in perf and alloc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the case k if ... =>
is passed to a collect
and should not be a function but a partial function.
There is always the option to change to a function and flatMap
on Option
but I don't know if that way it is worth the change...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that maybe you were exactly referring to that 😅 : bf74ff1
PR updated with a new commit |
1 similar comment
PR updated with a new commit |
I will need to be rebased after retarget to branche 7.3 |
4be737d
to
dec8ae9
Compare
PR rebased and updated with a new commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected !
This PR is not mergeable to upper versions. |
OK, squash merging this PR |
bf74ff1
to
6ff585c
Compare
6ff585c
into
Normation:branches/rudder/7.3
https://issues.rudder.io/issues/24318
Another condition is added to the
computeUpdatedUserList
: deleted users that are in active users list should be active again if they are from the same origin.The
computeUpdatedUserList
is being more patched over time, so I added unit tests to it, in addition to fixing the initial problem.