chore(users): add azure id to AddUserData

This commit is contained in:
Sarah Vaupel 2024-01-28 18:32:36 +01:00
parent 84d7890ae4
commit 9cbc35c263

View File

@ -1,4 +1,4 @@
-- SPDX-FileCopyrightText: 2022 Steffen Jost <jost@tcs.ifi.lmu.de> -- SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel <sarah.vaupel@uniworx.de>, Steffen Jost <jost@tcs.ifi.lmu.de>
-- --
-- SPDX-License-Identifier: AGPL-3.0-or-later -- SPDX-License-Identifier: AGPL-3.0-or-later
@ -12,10 +12,9 @@ module Utils.Users
import Import import Import
data AuthenticationKind = AuthKindLDAP | AuthKindPWHash | AuthKindNoLogin
data AuthenticationKind = AuthKindLDAP | AuthKindAzure | AuthKindPWHash | AuthKindNoLogin
deriving (Eq, Ord, Read, Show, Enum, Bounded, Generic, Universe, Finite) deriving (Eq, Ord, Read, Show, Enum, Bounded, Generic, Universe, Finite)
--instance Universe AuthenticationKind
--instance Finite AuthenticationKind
embedRenderMessage ''UniWorX ''AuthenticationKind id embedRenderMessage ''UniWorX ''AuthenticationKind id
nullaryPathPiece ''AuthenticationKind $ camelToPathPiece' 2 nullaryPathPiece ''AuthenticationKind $ camelToPathPiece' 2
@ -50,9 +49,11 @@ data AddUserData = AddUserData
, audEmail :: UserEmail , audEmail :: UserEmail
, audIdent :: UserIdent , audIdent :: UserIdent
, audAuth :: AuthenticationKind , audAuth :: AuthenticationKind
, audAzureId :: Maybe UUID
} }
-- | Adds a new user to database, no background jobs are scheduled, no notifications send
-- | Adds a new user to database; no background jobs are scheduled, no notifications sent
addNewUser :: AddUserData -> Handler (Maybe UserId) addNewUser :: AddUserData -> Handler (Maybe UserId)
addNewUser AddUserData{..} = do addNewUser AddUserData{..} = do
now <- liftIO getCurrentTime now <- liftIO getCurrentTime
@ -78,6 +79,8 @@ addNewUser AddUserData{..} = do
, userCreated = now , userCreated = now
, userLastLdapSynchronisation = Nothing , userLastLdapSynchronisation = Nothing
, userLdapPrimaryKey = audFPersonalNumber , userLdapPrimaryKey = audFPersonalNumber
, userLastAzureSynchronisation = Nothing
, userAzurePrimaryKey = audAzureId
, userLastAuthentication = Nothing , userLastAuthentication = Nothing
, userEmail = audEmail , userEmail = audEmail
, userDisplayName = audDisplayName , userDisplayName = audDisplayName