From 9cbc35c263e573ee0a281e24443bf1e5bcad0409 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Sun, 28 Jan 2024 18:32:36 +0100 Subject: [PATCH] chore(users): add azure id to AddUserData --- src/Utils/Users.hs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Utils/Users.hs b/src/Utils/Users.hs index 2339fbed5..a2eeb32f6 100644 --- a/src/Utils/Users.hs +++ b/src/Utils/Users.hs @@ -1,4 +1,4 @@ --- SPDX-FileCopyrightText: 2022 Steffen Jost +-- SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel , Steffen Jost -- -- 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 \ No newline at end of file + runDB $ insertUnique newUser \ No newline at end of file