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
@ -12,10 +12,9 @@ module Utils.Users
import Import
data AuthenticationKind = AuthKindLDAP | AuthKindPWHash | AuthKindNoLogin
data AuthenticationKind = AuthKindLDAP | AuthKindAzure | AuthKindPWHash | AuthKindNoLogin
deriving (Eq, Ord, Read, Show, Enum, Bounded, Generic, Universe, Finite)
--instance Universe AuthenticationKind
--instance Finite AuthenticationKind
embedRenderMessage ''UniWorX ''AuthenticationKind id
nullaryPathPiece ''AuthenticationKind $ camelToPathPiece' 2
@ -49,10 +48,12 @@ data AddUserData = AddUserData
, audPinPassword :: Maybe Text
, audEmail :: UserEmail
, 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{..} = do
now <- liftIO getCurrentTime
@ -78,6 +79,8 @@ addNewUser AddUserData{..} = do
, userCreated = now
, userLastLdapSynchronisation = Nothing
, userLdapPrimaryKey = audFPersonalNumber
, userLastAzureSynchronisation = Nothing
, userAzurePrimaryKey = audAzureId
, userLastAuthentication = Nothing
, userEmail = audEmail
, userDisplayName = audDisplayName
@ -98,4 +101,4 @@ addNewUser AddUserData{..} = do
, userMatrikelnummer = audMatriculation
, userAuthentication = mkAuthMode audAuth
}
runDB $ insertUnique newUser
runDB $ insertUnique newUser