-
Notifications
You must be signed in to change notification settings - Fork 325
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
Implement active flag in SCIM #1158
Conversation
almost compiles. Need to add the Intra calls still
Involved exposing some types in brig that were internal before.
This is the error the bash script is giving me by the way:
|
services/spar/src/Spar/Scim/User.hs
Outdated
let neededInfo = NeededInfo handle name externalId richInfo | ||
-- NOTE: A user can be 'Active | Deleted | Ephemeral | Suspended'. We | ||
-- only consider them Active when they're 'Active' | ||
let neededInfo = NeededInfo handle name externalId richInfo (Just (status == Active)) |
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.
what about ephemeral users? can we even create them here? but even if not, we're moving towards accessing brig data directly from both brig and scim, and this will be an interesting case.
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.
-- We make the assumption that when the `active` field is not there, that the user is | ||
-- active by default; such that the IdP will de-activate it when it disagrees with the IdP | ||
-- state. Now if the IdP wants to remove the "active" field altogether, we dont "know" | ||
-- anything again, and this should cause the user to be "active" again. This |
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.
"This" is not a complete sentence :-) It's also not clear how an IdP comes into play here. Do you mean the SCIM peer that patches the user? What does it mean if "it" (the IdP, presumably) disagrees with the (same?) IdP state?
Anyway I think it makes no sense to change the activation state if the SCIM peer explicitly does NOT patch it. I think we should leave it at whatever it is in that case. I suspect the reason why you came up with the current semantics is due to the confusion about the different representations of the user in brig and spar. See https://github.com/zinfra/backend-issues/issues/1006
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.
Looks good, but I think we need to revisit #1158 (comment) and #1158 (comment), and probably make some more changes to resolve them. |
both more correct (does not fail on valid requests) and more readable, maintainable.
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.
thanks @mheinzel !
Deleted -> False | ||
Ephemeral -> True -- do not treat ephemeral users any different from active ones. | ||
|
||
scimActiveFlagToAccountStatus :: AccountStatus -> Maybe Bool -> AccountStatus |
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.
add a comment here!
services/spar/src/Spar/Scim/Types.hs
Outdated
scimActiveFlagToAccountStatus :: AccountStatus -> Maybe Bool -> AccountStatus | ||
scimActiveFlagToAccountStatus oldstatus = \case | ||
Nothing -> if oldstatus == Ephemeral then Ephemeral else Active | ||
Just True -> Active |
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.
Just True -> Active | |
Just True -> if oldstatus == Ephemeral then Ephemeral else Active |
concourse says:
I'll try again. |
Reproducible. Here is another possibly helpful chunk from the logs:
|
When the active flag is false, suspend the user
Fixes https://github.com/zinfra/backend-issues/issues/1471
TODOs that I couldn't get done:
tools/ormolu.sh
script refuses to run on my computer, there's a bash bug somewhere, oryq
on nixos is something different than what you are using)