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 55f39d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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
8 changes: 8 additions & 0 deletions services/brig/src/Brig/API/User.hs
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,14 @@ changeLocale ::
LocaleUpdate ->
(AppT r) ()
changeLocale uid conn (LocaleUpdate loc) = do
usr <- lift $ wrapClient $ Data.lookupUser WithPendingInvitations uid
unless
( userManagedBy u /= ManagedByScim
|| Just loc == userLocale u
|| allowScim == AllowSCIMUpdates
)
$ throwE ChangeHandleManagedByScim

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

Expand Down

0 comments on commit 55f39d4

Please sign in to comment.