refactor(model): migrate auth models and model types to models/auth.model
This commit is contained in:
parent
42c97924ec
commit
7803b753cb
28
models/auth.model
Normal file
28
models/auth.model
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
-- SPDX-FileCopyrightText: 2024 Sarah Vaupel <sarah.vaupel@uniworx.de>
|
||||||
|
--
|
||||||
|
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
-- | User authentication data, source-agnostic data
|
||||||
|
UserAuth
|
||||||
|
ident UserIdent -- Human-readable text uniquely identifying a user
|
||||||
|
lastLogin UTCTime -- When did the corresponding User last authenticate using this entry?
|
||||||
|
Primary ident
|
||||||
|
UniqueAuthentication ident
|
||||||
|
deriving Show Eq Ord Generic
|
||||||
|
|
||||||
|
-- | User authentication data fetched from external user sources
|
||||||
|
ExternalAuth
|
||||||
|
ident UserIdent
|
||||||
|
source AuthenticationSourceIdent -- Identifier of the external source in the config
|
||||||
|
data Value "default='{}'::jsonb" -- Raw user data from external source
|
||||||
|
lastSync UTCTime -- When was the corresponding User entry last synced with this external source?
|
||||||
|
UniqueExternalAuth ident source -- At most one entry of this user per source
|
||||||
|
deriving Show Eq Ord Generic
|
||||||
|
|
||||||
|
-- | FraDrive-specific user authentication data, internal logins have precedence over external authentication
|
||||||
|
InternalAuth
|
||||||
|
ident UserIdent
|
||||||
|
hash Text -- Hashed password
|
||||||
|
Primary ident
|
||||||
|
UniqueInternalAuth ident
|
||||||
|
deriving Show Eq Ord Generic
|
||||||
@ -51,31 +51,6 @@ User json -- Each Uni2work user has a corresponding row in this table; create
|
|||||||
UniqueEmail email -- Column 'email' can be used as a row-key in this table
|
UniqueEmail email -- Column 'email' can be used as a row-key in this table
|
||||||
deriving Show Eq Ord Generic -- Haskell-specific settings for runtime-value representing a row in memory
|
deriving Show Eq Ord Generic -- Haskell-specific settings for runtime-value representing a row in memory
|
||||||
|
|
||||||
-- | User authentication data, source-agnostic data
|
|
||||||
UserAuth
|
|
||||||
ident UserIdent -- Human-readable text uniquely identifying a user
|
|
||||||
lastLogin UTCTime -- When did the corresponding User last authenticate using this entry?
|
|
||||||
Primary ident
|
|
||||||
UniqueAuthentication ident
|
|
||||||
deriving Show Eq Ord Generic
|
|
||||||
|
|
||||||
-- | User authentication data fetched from external user sources
|
|
||||||
ExternalAuth
|
|
||||||
ident UserIdent
|
|
||||||
source AuthenticationSourceIdent -- Identifier of the external source in the config
|
|
||||||
data Value "default='{}'::jsonb" -- Raw user data from external source
|
|
||||||
lastSync UTCTime -- When was the corresponding User entry last synced with this external source?
|
|
||||||
UniqueExternalAuth ident source -- At most one entry of this user per source
|
|
||||||
deriving Show Eq Ord Generic
|
|
||||||
|
|
||||||
-- | FraDrive-specific user authentication data, internal logins have precedence over external authentication
|
|
||||||
InternalAuth
|
|
||||||
ident UserIdent
|
|
||||||
hash Text -- Hashed password
|
|
||||||
Primary ident
|
|
||||||
UniqueInternalAuth ident
|
|
||||||
deriving Show Eq Ord Generic
|
|
||||||
|
|
||||||
UserFunction -- Administratively assigned functions (lecturer, admin, evaluation, ...)
|
UserFunction -- Administratively assigned functions (lecturer, admin, evaluation, ...)
|
||||||
user UserId
|
user UserId
|
||||||
school SchoolId
|
school SchoolId
|
||||||
|
|||||||
@ -48,6 +48,9 @@ import Database.Persist.Sql
|
|||||||
import Servant.Docs (ToSample(..), samples)
|
import Servant.Docs (ToSample(..), samples)
|
||||||
|
|
||||||
|
|
||||||
|
type UserEduPersonPrincipalName = Text
|
||||||
|
|
||||||
|
|
||||||
-- | Supported protocols for external user sources used for authentication queries
|
-- | Supported protocols for external user sources used for authentication queries
|
||||||
data AuthenticationProtocol
|
data AuthenticationProtocol
|
||||||
= AuthAzure -- ^ Azure ADv2 (OAuth2)
|
= AuthAzure -- ^ Azure ADv2 (OAuth2)
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
-- SPDX-FileCopyrightText: 2022 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Sarah Vaupel <sarah.vaupel@ifi.lmu.de>,Steffen Jost <jost@tcs.ifi.lmu.de>
|
-- SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel <sarah.vaupel@uniworx.de>, Gregor Kleen <gregor.kleen@ifi.lmu.de>, Sarah Vaupel <sarah.vaupel@ifi.lmu.de>, Steffen Jost <jost@tcs.ifi.lmu.de>
|
||||||
--
|
--
|
||||||
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
@ -8,9 +8,6 @@ import Import.NoModel
|
|||||||
import Model.Types.TH.PathPiece
|
import Model.Types.TH.PathPiece
|
||||||
|
|
||||||
|
|
||||||
type UserEduPersonPrincipalName = Text
|
|
||||||
|
|
||||||
|
|
||||||
data SystemFunction
|
data SystemFunction
|
||||||
= SystemExamOffice
|
= SystemExamOffice
|
||||||
| SystemFaculty
|
| SystemFaculty
|
||||||
|
|||||||
Reference in New Issue
Block a user