Skip to content

Commit

Permalink
Forbid locale updates for scim-managed users.
Browse files Browse the repository at this point in the history
  • Loading branch information
fisx committed Jun 3, 2024
1 parent d66df38 commit 907ac61
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion changelog.d/3-bug-fixes/WPB-9488-fix-update-origin
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Do not set update origin "scim" in public brig api.
Do not set update origin "scim" in public brig api. (#4072, #4078)
2 changes: 1 addition & 1 deletion services/brig/src/Brig/API/Public.hs
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ changeLocale ::
ConnId ->
Public.LocaleUpdate ->
(Handler r) ()
changeLocale u conn l = lift $ API.changeLocale u conn l
changeLocale u conn l = lift $ API.changeLocale u conn l API.ForbidSCIMUpdates

changeSupportedProtocols ::
( Member (Embed HttpClientIO) r,
Expand Down
11 changes: 10 additions & 1 deletion services/brig/src/Brig/API/User.hs
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,17 @@ changeLocale ::
UserId ->
ConnId ->
LocaleUpdate ->
AllowSCIMUpdates ->
(AppT r) ()
changeLocale uid conn (LocaleUpdate loc) = do
changeLocale uid conn (LocaleUpdate loc) allowScim = do
usr <- lift $ wrapClient $ Data.lookupUser WithPendingInvitations uid
unless
( userManagedBy usr /= ManagedByScim
|| Just loc == userLocale usr
|| allowScim == AllowSCIMUpdates
)
$ throwE ChangeHandleManagedByScim

wrapClient $ Data.updateLocale uid loc
liftSem $ Intra.onUserEvent uid (Just conn) (localeUpdate uid loc)

Expand Down

0 comments on commit 907ac61

Please sign in to comment.