servant-auth-token-0.5.4.0: Servant based API and server for token based authorisation

Copyright(c) Anton Gushcha 2016
LicenseMIT
Maintainerncrashed@gmail.com
Stabilityexperimental
PortabilityPortable
Safe HaskellNone
LanguageHaskell2010

Servant.Server.Auth.Token.Model

Contents

Description

 
Synopsis

DB entities

data UserImpl Source #

Internal user implementation

Constructors

UserImpl 

Fields

Instances
Show UserImpl Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Generic UserImpl Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Associated Types

type Rep UserImpl :: * -> * #

Methods

from :: UserImpl -> Rep UserImpl x #

to :: Rep UserImpl x -> UserImpl #

type Rep UserImpl Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep UserImpl = D1 (MetaData "UserImpl" "Servant.Server.Auth.Token.Model" "servant-auth-token-0.5.4.0-LmMa4gnsmOZBo06ls3QnQg" False) (C1 (MetaCons "UserImpl" PrefixI True) (S1 (MetaSel (Just "userImplLogin") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Login) :*: (S1 (MetaSel (Just "userImplPassword") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Password) :*: S1 (MetaSel (Just "userImplEmail") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Email))))

data UserPerm Source #

Internal implementation of permission (1-M)

Constructors

UserPerm 

Fields

Instances
Show UserPerm Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Generic UserPerm Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Associated Types

type Rep UserPerm :: * -> * #

Methods

from :: UserPerm -> Rep UserPerm x #

to :: Rep UserPerm x -> UserPerm #

type Rep UserPerm Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep UserPerm = D1 (MetaData "UserPerm" "Servant.Server.Auth.Token.Model" "servant-auth-token-0.5.4.0-LmMa4gnsmOZBo06ls3QnQg" False) (C1 (MetaCons "UserPerm" PrefixI True) (S1 (MetaSel (Just "userPermUser") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 UserImplId) :*: S1 (MetaSel (Just "userPermPermission") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Permission)))

data AuthToken Source #

Internal implementation of authorisation token

Constructors

AuthToken 

Fields

Instances
Show AuthToken Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Generic AuthToken Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Associated Types

type Rep AuthToken :: * -> * #

type Rep AuthToken Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep AuthToken = D1 (MetaData "AuthToken" "Servant.Server.Auth.Token.Model" "servant-auth-token-0.5.4.0-LmMa4gnsmOZBo06ls3QnQg" False) (C1 (MetaCons "AuthToken" PrefixI True) (S1 (MetaSel (Just "authTokenValue") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 SimpleToken) :*: (S1 (MetaSel (Just "authTokenUser") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 UserImplId) :*: S1 (MetaSel (Just "authTokenExpire") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 UTCTime))))

data UserRestore Source #

Internal implementation of restoration code

Constructors

UserRestore 

Fields

Instances
Show UserRestore Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Generic UserRestore Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Associated Types

type Rep UserRestore :: * -> * #

type Rep UserRestore Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep UserRestore = D1 (MetaData "UserRestore" "Servant.Server.Auth.Token.Model" "servant-auth-token-0.5.4.0-LmMa4gnsmOZBo06ls3QnQg" False) (C1 (MetaCons "UserRestore" PrefixI True) (S1 (MetaSel (Just "userRestoreValue") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 RestoreCode) :*: (S1 (MetaSel (Just "userRestoreUser") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 UserImplId) :*: S1 (MetaSel (Just "userRestoreExpire") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 UTCTime))))

data AuthUserGroup Source #

Internal implementation of user group

Constructors

AuthUserGroup 

Fields

Instances
Show AuthUserGroup Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Generic AuthUserGroup Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Associated Types

type Rep AuthUserGroup :: * -> * #

type Rep AuthUserGroup Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep AuthUserGroup = D1 (MetaData "AuthUserGroup" "Servant.Server.Auth.Token.Model" "servant-auth-token-0.5.4.0-LmMa4gnsmOZBo06ls3QnQg" False) (C1 (MetaCons "AuthUserGroup" PrefixI True) (S1 (MetaSel (Just "authUserGroupName") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text) :*: S1 (MetaSel (Just "authUserGroupParent") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe AuthUserGroupId))))

data AuthUserGroupUsers Source #

Implementation of M-M between user and group

Instances
Show AuthUserGroupUsers Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Generic AuthUserGroupUsers Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Associated Types

type Rep AuthUserGroupUsers :: * -> * #

type Rep AuthUserGroupUsers Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep AuthUserGroupUsers = D1 (MetaData "AuthUserGroupUsers" "Servant.Server.Auth.Token.Model" "servant-auth-token-0.5.4.0-LmMa4gnsmOZBo06ls3QnQg" False) (C1 (MetaCons "AuthUserGroupUsers" PrefixI True) (S1 (MetaSel (Just "authUserGroupUsersGroup") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 AuthUserGroupId) :*: S1 (MetaSel (Just "authUserGroupUsersUser") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 UserImplId)))

data AuthUserGroupPerms Source #

Implementation of M-M between permission and group

Instances
Show AuthUserGroupPerms Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Generic AuthUserGroupPerms Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Associated Types

type Rep AuthUserGroupPerms :: * -> * #

type Rep AuthUserGroupPerms Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep AuthUserGroupPerms = D1 (MetaData "AuthUserGroupPerms" "Servant.Server.Auth.Token.Model" "servant-auth-token-0.5.4.0-LmMa4gnsmOZBo06ls3QnQg" False) (C1 (MetaCons "AuthUserGroupPerms" PrefixI True) (S1 (MetaSel (Just "authUserGroupPermsGroup") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 AuthUserGroupId) :*: S1 (MetaSel (Just "authUserGroupPermsPermission") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Permission)))

data UserSingleUseCode Source #

Internal implementation of single use code

Constructors

UserSingleUseCode 

Fields

Instances
Show UserSingleUseCode Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Generic UserSingleUseCode Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Associated Types

type Rep UserSingleUseCode :: * -> * #

type Rep UserSingleUseCode Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep UserSingleUseCode = D1 (MetaData "UserSingleUseCode" "Servant.Server.Auth.Token.Model" "servant-auth-token-0.5.4.0-LmMa4gnsmOZBo06ls3QnQg" False) (C1 (MetaCons "UserSingleUseCode" PrefixI True) ((S1 (MetaSel (Just "userSingleUseCodeValue") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 SingleUseCode) :*: S1 (MetaSel (Just "userSingleUseCodeUser") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 UserImplId)) :*: (S1 (MetaSel (Just "userSingleUseCodeExpire") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe UTCTime)) :*: S1 (MetaSel (Just "userSingleUseCodeUsed") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe UTCTime)))))

IDs of entities

data UserImplId Source #

ID of user

Instances
Eq UserImplId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Ord UserImplId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Show UserImplId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Generic UserImplId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Associated Types

type Rep UserImplId :: * -> * #

ConvertableKey UserImplId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep UserImplId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep UserImplId = D1 (MetaData "UserImplId" "Servant.Server.Auth.Token.Model" "servant-auth-token-0.5.4.0-LmMa4gnsmOZBo06ls3QnQg" True) (C1 (MetaCons "UserImplId" PrefixI True) (S1 (MetaSel (Just "unUserImplId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int64)))

data UserPermId Source #

ID of user permission

Instances
Eq UserPermId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Ord UserPermId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Show UserPermId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Generic UserPermId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Associated Types

type Rep UserPermId :: * -> * #

ConvertableKey UserPermId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep UserPermId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep UserPermId = D1 (MetaData "UserPermId" "Servant.Server.Auth.Token.Model" "servant-auth-token-0.5.4.0-LmMa4gnsmOZBo06ls3QnQg" True) (C1 (MetaCons "UserPermId" PrefixI True) (S1 (MetaSel (Just "unUserPermId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int64)))

data AuthTokenId Source #

ID of authorisation token

Instances
Eq AuthTokenId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Ord AuthTokenId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Show AuthTokenId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Generic AuthTokenId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Associated Types

type Rep AuthTokenId :: * -> * #

ConvertableKey AuthTokenId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep AuthTokenId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep AuthTokenId = D1 (MetaData "AuthTokenId" "Servant.Server.Auth.Token.Model" "servant-auth-token-0.5.4.0-LmMa4gnsmOZBo06ls3QnQg" True) (C1 (MetaCons "AuthTokenId" PrefixI True) (S1 (MetaSel (Just "unAuthTokenId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int64)))

data UserRestoreId Source #

ID of restoration code

Instances
Eq UserRestoreId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Ord UserRestoreId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Show UserRestoreId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Generic UserRestoreId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Associated Types

type Rep UserRestoreId :: * -> * #

ConvertableKey UserRestoreId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep UserRestoreId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep UserRestoreId = D1 (MetaData "UserRestoreId" "Servant.Server.Auth.Token.Model" "servant-auth-token-0.5.4.0-LmMa4gnsmOZBo06ls3QnQg" True) (C1 (MetaCons "UserRestoreId" PrefixI True) (S1 (MetaSel (Just "unUserRestoreId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int64)))

data AuthUserGroupId Source #

ID of user group

Instances
Eq AuthUserGroupId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Ord AuthUserGroupId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Show AuthUserGroupId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Generic AuthUserGroupId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Associated Types

type Rep AuthUserGroupId :: * -> * #

ConvertableKey AuthUserGroupId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep AuthUserGroupId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep AuthUserGroupId = D1 (MetaData "AuthUserGroupId" "Servant.Server.Auth.Token.Model" "servant-auth-token-0.5.4.0-LmMa4gnsmOZBo06ls3QnQg" True) (C1 (MetaCons "AuthUserGroupId" PrefixI True) (S1 (MetaSel (Just "unAuthUserGroupId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int64)))

data AuthUserGroupUsersId Source #

ID of user-group binding

Instances
Eq AuthUserGroupUsersId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Ord AuthUserGroupUsersId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Show AuthUserGroupUsersId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Generic AuthUserGroupUsersId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Associated Types

type Rep AuthUserGroupUsersId :: * -> * #

ConvertableKey AuthUserGroupUsersId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep AuthUserGroupUsersId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep AuthUserGroupUsersId = D1 (MetaData "AuthUserGroupUsersId" "Servant.Server.Auth.Token.Model" "servant-auth-token-0.5.4.0-LmMa4gnsmOZBo06ls3QnQg" True) (C1 (MetaCons "AuthUserGroupUsersId" PrefixI True) (S1 (MetaSel (Just "unAuthUserGroupUsersId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int64)))

data AuthUserGroupPermsId Source #

ID of permission-group binding

Instances
Eq AuthUserGroupPermsId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Ord AuthUserGroupPermsId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Show AuthUserGroupPermsId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Generic AuthUserGroupPermsId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Associated Types

type Rep AuthUserGroupPermsId :: * -> * #

ConvertableKey AuthUserGroupPermsId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep AuthUserGroupPermsId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep AuthUserGroupPermsId = D1 (MetaData "AuthUserGroupPermsId" "Servant.Server.Auth.Token.Model" "servant-auth-token-0.5.4.0-LmMa4gnsmOZBo06ls3QnQg" True) (C1 (MetaCons "AuthUserGroupPermsId" PrefixI True) (S1 (MetaSel (Just "unAuthUserGroupPermsId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int64)))

data UserSingleUseCodeId Source #

ID of single use code

Instances
Eq UserSingleUseCodeId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Ord UserSingleUseCodeId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Show UserSingleUseCodeId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Generic UserSingleUseCodeId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Associated Types

type Rep UserSingleUseCodeId :: * -> * #

ConvertableKey UserSingleUseCodeId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep UserSingleUseCodeId Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

type Rep UserSingleUseCodeId = D1 (MetaData "UserSingleUseCodeId" "Servant.Server.Auth.Token.Model" "servant-auth-token-0.5.4.0-LmMa4gnsmOZBo06ls3QnQg" True) (C1 (MetaCons "UserSingleUseCodeId" PrefixI True) (S1 (MetaSel (Just "unUserSingleUseCodeId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int64)))

DB interface

class MonadIO m => HasStorage m where Source #

Abstract storage interface. External libraries can implement this in terms of PostgreSQL or acid-state.

Methods

getUserImpl :: UserImplId -> m (Maybe UserImpl) Source #

Getting user from storage

getUserImpl :: (m ~ t n, MonadTrans t, HasStorage n) => UserImplId -> m (Maybe UserImpl) Source #

Getting user from storage

getUserImplByLogin :: Login -> m (Maybe (WithId UserImplId UserImpl)) Source #

Getting user from storage by login

getUserImplByLogin :: (m ~ t n, MonadTrans t, HasStorage n) => Login -> m (Maybe (WithId UserImplId UserImpl)) Source #

Getting user from storage by login

listUsersPaged :: Page -> PageSize -> m ([WithId UserImplId UserImpl], Word) Source #

Get paged list of users and total count of users

listUsersPaged :: (m ~ t n, MonadTrans t, HasStorage n) => Page -> PageSize -> m ([WithId UserImplId UserImpl], Word) Source #

Get paged list of users and total count of users

getUserImplPermissions :: UserImplId -> m [WithId UserPermId UserPerm] Source #

Get user permissions, ascending by tag

getUserImplPermissions :: (m ~ t n, MonadTrans t, HasStorage n) => UserImplId -> m [WithId UserPermId UserPerm] Source #

Get user permissions, ascending by tag

deleteUserPermissions :: UserImplId -> m () Source #

Delete user permissions

deleteUserPermissions :: (m ~ t n, MonadTrans t, HasStorage n) => UserImplId -> m () Source #

Delete user permissions

insertUserPerm :: UserPerm -> m UserPermId Source #

Insertion of new user permission

insertUserPerm :: (m ~ t n, MonadTrans t, HasStorage n) => UserPerm -> m UserPermId Source #

Insertion of new user permission

insertUserImpl :: UserImpl -> m UserImplId Source #

Insertion of new user

insertUserImpl :: (m ~ t n, MonadTrans t, HasStorage n) => UserImpl -> m UserImplId Source #

Insertion of new user

replaceUserImpl :: UserImplId -> UserImpl -> m () Source #

Replace user with new value

replaceUserImpl :: (m ~ t n, MonadTrans t, HasStorage n) => UserImplId -> UserImpl -> m () Source #

Replace user with new value

deleteUserImpl :: UserImplId -> m () Source #

Delete user by id

deleteUserImpl :: (m ~ t n, MonadTrans t, HasStorage n) => UserImplId -> m () Source #

Delete user by id

hasPerm :: UserImplId -> Permission -> m Bool Source #

Check whether the user has particular permission

hasPerm :: (m ~ t n, MonadTrans t, HasStorage n) => UserImplId -> Permission -> m Bool Source #

Check whether the user has particular permission

getFirstUserByPerm :: Permission -> m (Maybe (WithId UserImplId UserImpl)) Source #

Get any user with given permission

getFirstUserByPerm :: (m ~ t n, MonadTrans t, HasStorage n) => Permission -> m (Maybe (WithId UserImplId UserImpl)) Source #

Get any user with given permission

selectUserImplGroups :: UserImplId -> m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

Select user groups and sort them by ascending name

selectUserImplGroups :: (m ~ t n, MonadTrans t, HasStorage n) => UserImplId -> m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

Select user groups and sort them by ascending name

clearUserImplGroups :: UserImplId -> m () Source #

Remove user from all groups

clearUserImplGroups :: (m ~ t n, MonadTrans t, HasStorage n) => UserImplId -> m () Source #

Remove user from all groups

insertAuthUserGroup :: AuthUserGroup -> m AuthUserGroupId Source #

Add new user group

insertAuthUserGroup :: (m ~ t n, MonadTrans t, HasStorage n) => AuthUserGroup -> m AuthUserGroupId Source #

Add new user group

insertAuthUserGroupUsers :: AuthUserGroupUsers -> m AuthUserGroupUsersId Source #

Add user to given group

insertAuthUserGroupUsers :: (m ~ t n, MonadTrans t, HasStorage n) => AuthUserGroupUsers -> m AuthUserGroupUsersId Source #

Add user to given group

insertAuthUserGroupPerms :: AuthUserGroupPerms -> m AuthUserGroupPermsId Source #

Add permission to given group

insertAuthUserGroupPerms :: (m ~ t n, MonadTrans t, HasStorage n) => AuthUserGroupPerms -> m AuthUserGroupPermsId Source #

Add permission to given group

getAuthUserGroup :: AuthUserGroupId -> m (Maybe AuthUserGroup) Source #

Find user group by id

getAuthUserGroup :: (m ~ t n, MonadTrans t, HasStorage n) => AuthUserGroupId -> m (Maybe AuthUserGroup) Source #

Find user group by id

listAuthUserGroupPermissions :: AuthUserGroupId -> m [WithId AuthUserGroupPermsId AuthUserGroupPerms] Source #

Get list of permissions of given group

listAuthUserGroupPermissions :: (m ~ t n, MonadTrans t, HasStorage n) => AuthUserGroupId -> m [WithId AuthUserGroupPermsId AuthUserGroupPerms] Source #

Get list of permissions of given group

listAuthUserGroupUsers :: AuthUserGroupId -> m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

Get list of all users of the group

listAuthUserGroupUsers :: (m ~ t n, MonadTrans t, HasStorage n) => AuthUserGroupId -> m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

Get list of all users of the group

replaceAuthUserGroup :: AuthUserGroupId -> AuthUserGroup -> m () Source #

Replace record of user group

replaceAuthUserGroup :: (m ~ t n, MonadTrans t, HasStorage n) => AuthUserGroupId -> AuthUserGroup -> m () Source #

Replace record of user group

clearAuthUserGroupUsers :: AuthUserGroupId -> m () Source #

Remove all users from group

clearAuthUserGroupUsers :: (m ~ t n, MonadTrans t, HasStorage n) => AuthUserGroupId -> m () Source #

Remove all users from group

clearAuthUserGroupPerms :: AuthUserGroupId -> m () Source #

Remove all permissions from group

clearAuthUserGroupPerms :: (m ~ t n, MonadTrans t, HasStorage n) => AuthUserGroupId -> m () Source #

Remove all permissions from group

deleteAuthUserGroup :: AuthUserGroupId -> m () Source #

Delete user group from storage

deleteAuthUserGroup :: (m ~ t n, MonadTrans t, HasStorage n) => AuthUserGroupId -> m () Source #

Delete user group from storage

listGroupsPaged :: Page -> PageSize -> m ([WithId AuthUserGroupId AuthUserGroup], Word) Source #

Get paged list of user groups with total count

listGroupsPaged :: (m ~ t n, MonadTrans t, HasStorage n) => Page -> PageSize -> m ([WithId AuthUserGroupId AuthUserGroup], Word) Source #

Get paged list of user groups with total count

setAuthUserGroupName :: AuthUserGroupId -> Text -> m () Source #

Set group name

setAuthUserGroupName :: (m ~ t n, MonadTrans t, HasStorage n) => AuthUserGroupId -> Text -> m () Source #

Set group name

setAuthUserGroupParent :: AuthUserGroupId -> Maybe AuthUserGroupId -> m () Source #

Set group parent

setAuthUserGroupParent :: (m ~ t n, MonadTrans t, HasStorage n) => AuthUserGroupId -> Maybe AuthUserGroupId -> m () Source #

Set group parent

insertSingleUseCode :: UserSingleUseCode -> m UserSingleUseCodeId Source #

Add new single use code

insertSingleUseCode :: (m ~ t n, MonadTrans t, HasStorage n) => UserSingleUseCode -> m UserSingleUseCodeId Source #

Add new single use code

setSingleUseCodeUsed :: UserSingleUseCodeId -> Maybe UTCTime -> m () Source #

Set usage time of the single use code

setSingleUseCodeUsed :: (m ~ t n, MonadTrans t, HasStorage n) => UserSingleUseCodeId -> Maybe UTCTime -> m () Source #

Set usage time of the single use code

getUnusedCode :: SingleUseCode -> UserImplId -> UTCTime -> m (Maybe (WithId UserSingleUseCodeId UserSingleUseCode)) Source #

Find unused code for the user and expiration time greater than the given time

getUnusedCode :: (m ~ t n, MonadTrans t, HasStorage n) => SingleUseCode -> UserImplId -> UTCTime -> m (Maybe (WithId UserSingleUseCodeId UserSingleUseCode)) Source #

Find unused code for the user and expiration time greater than the given time

invalidatePermanentCodes :: UserImplId -> UTCTime -> m () Source #

Invalidate all permanent codes for user and set use time for them

invalidatePermanentCodes :: (m ~ t n, MonadTrans t, HasStorage n) => UserImplId -> UTCTime -> m () Source #

Invalidate all permanent codes for user and set use time for them

selectLastRestoreCode :: UserImplId -> UTCTime -> m (Maybe (WithId UserRestoreId UserRestore)) Source #

Select last valid restoration code by the given current time

selectLastRestoreCode :: (m ~ t n, MonadTrans t, HasStorage n) => UserImplId -> UTCTime -> m (Maybe (WithId UserRestoreId UserRestore)) Source #

Select last valid restoration code by the given current time

insertUserRestore :: UserRestore -> m UserRestoreId Source #

Insert new restore code

insertUserRestore :: (m ~ t n, MonadTrans t, HasStorage n) => UserRestore -> m UserRestoreId Source #

Insert new restore code

findRestoreCode :: UserImplId -> RestoreCode -> UTCTime -> m (Maybe (WithId UserRestoreId UserRestore)) Source #

Find unexpired by the time restore code

findRestoreCode :: (m ~ t n, MonadTrans t, HasStorage n) => UserImplId -> RestoreCode -> UTCTime -> m (Maybe (WithId UserRestoreId UserRestore)) Source #

Find unexpired by the time restore code

replaceRestoreCode :: UserRestoreId -> UserRestore -> m () Source #

Replace restore code with new value

replaceRestoreCode :: (m ~ t n, MonadTrans t, HasStorage n) => UserRestoreId -> UserRestore -> m () Source #

Replace restore code with new value

findAuthToken :: UserImplId -> UTCTime -> m (Maybe (WithId AuthTokenId AuthToken)) Source #

Find first non-expired by the time token for user

findAuthToken :: (m ~ t n, MonadTrans t, HasStorage n) => UserImplId -> UTCTime -> m (Maybe (WithId AuthTokenId AuthToken)) Source #

Find first non-expired by the time token for user

findAuthTokenByValue :: SimpleToken -> m (Maybe (WithId AuthTokenId AuthToken)) Source #

Find token by value

findAuthTokenByValue :: (m ~ t n, MonadTrans t, HasStorage n) => SimpleToken -> m (Maybe (WithId AuthTokenId AuthToken)) Source #

Find token by value

insertAuthToken :: AuthToken -> m AuthTokenId Source #

Insert new token

insertAuthToken :: (m ~ t n, MonadTrans t, HasStorage n) => AuthToken -> m AuthTokenId Source #

Insert new token

replaceAuthToken :: AuthTokenId -> AuthToken -> m () Source #

Replace auth token with new value

replaceAuthToken :: (m ~ t n, MonadTrans t, HasStorage n) => AuthTokenId -> AuthToken -> m () Source #

Replace auth token with new value

Instances
HasStorage m => HasStorage (ExceptT e m) Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Methods

getUserImpl :: UserImplId -> ExceptT e m (Maybe UserImpl) Source #

getUserImplByLogin :: Login -> ExceptT e m (Maybe (WithId UserImplId UserImpl)) Source #

listUsersPaged :: Page -> PageSize -> ExceptT e m ([WithId UserImplId UserImpl], Word) Source #

getUserImplPermissions :: UserImplId -> ExceptT e m [WithId UserPermId UserPerm] Source #

deleteUserPermissions :: UserImplId -> ExceptT e m () Source #

insertUserPerm :: UserPerm -> ExceptT e m UserPermId Source #

insertUserImpl :: UserImpl -> ExceptT e m UserImplId Source #

replaceUserImpl :: UserImplId -> UserImpl -> ExceptT e m () Source #

deleteUserImpl :: UserImplId -> ExceptT e m () Source #

hasPerm :: UserImplId -> Permission -> ExceptT e m Bool Source #

getFirstUserByPerm :: Permission -> ExceptT e m (Maybe (WithId UserImplId UserImpl)) Source #

selectUserImplGroups :: UserImplId -> ExceptT e m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

clearUserImplGroups :: UserImplId -> ExceptT e m () Source #

insertAuthUserGroup :: AuthUserGroup -> ExceptT e m AuthUserGroupId Source #

insertAuthUserGroupUsers :: AuthUserGroupUsers -> ExceptT e m AuthUserGroupUsersId Source #

insertAuthUserGroupPerms :: AuthUserGroupPerms -> ExceptT e m AuthUserGroupPermsId Source #

getAuthUserGroup :: AuthUserGroupId -> ExceptT e m (Maybe AuthUserGroup) Source #

listAuthUserGroupPermissions :: AuthUserGroupId -> ExceptT e m [WithId AuthUserGroupPermsId AuthUserGroupPerms] Source #

listAuthUserGroupUsers :: AuthUserGroupId -> ExceptT e m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

replaceAuthUserGroup :: AuthUserGroupId -> AuthUserGroup -> ExceptT e m () Source #

clearAuthUserGroupUsers :: AuthUserGroupId -> ExceptT e m () Source #

clearAuthUserGroupPerms :: AuthUserGroupId -> ExceptT e m () Source #

deleteAuthUserGroup :: AuthUserGroupId -> ExceptT e m () Source #

listGroupsPaged :: Page -> PageSize -> ExceptT e m ([WithId AuthUserGroupId AuthUserGroup], Word) Source #

setAuthUserGroupName :: AuthUserGroupId -> Text -> ExceptT e m () Source #

setAuthUserGroupParent :: AuthUserGroupId -> Maybe AuthUserGroupId -> ExceptT e m () Source #

insertSingleUseCode :: UserSingleUseCode -> ExceptT e m UserSingleUseCodeId Source #

setSingleUseCodeUsed :: UserSingleUseCodeId -> Maybe UTCTime -> ExceptT e m () Source #

getUnusedCode :: SingleUseCode -> UserImplId -> UTCTime -> ExceptT e m (Maybe (WithId UserSingleUseCodeId UserSingleUseCode)) Source #

invalidatePermanentCodes :: UserImplId -> UTCTime -> ExceptT e m () Source #

selectLastRestoreCode :: UserImplId -> UTCTime -> ExceptT e m (Maybe (WithId UserRestoreId UserRestore)) Source #

insertUserRestore :: UserRestore -> ExceptT e m UserRestoreId Source #

findRestoreCode :: UserImplId -> RestoreCode -> UTCTime -> ExceptT e m (Maybe (WithId UserRestoreId UserRestore)) Source #

replaceRestoreCode :: UserRestoreId -> UserRestore -> ExceptT e m () Source #

findAuthToken :: UserImplId -> UTCTime -> ExceptT e m (Maybe (WithId AuthTokenId AuthToken)) Source #

findAuthTokenByValue :: SimpleToken -> ExceptT e m (Maybe (WithId AuthTokenId AuthToken)) Source #

insertAuthToken :: AuthToken -> ExceptT e m AuthTokenId Source #

replaceAuthToken :: AuthTokenId -> AuthToken -> ExceptT e m () Source #

(HasStorage m, Monoid w) => HasStorage (WriterT w m) Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Methods

getUserImpl :: UserImplId -> WriterT w m (Maybe UserImpl) Source #

getUserImplByLogin :: Login -> WriterT w m (Maybe (WithId UserImplId UserImpl)) Source #

listUsersPaged :: Page -> PageSize -> WriterT w m ([WithId UserImplId UserImpl], Word) Source #

getUserImplPermissions :: UserImplId -> WriterT w m [WithId UserPermId UserPerm] Source #

deleteUserPermissions :: UserImplId -> WriterT w m () Source #

insertUserPerm :: UserPerm -> WriterT w m UserPermId Source #

insertUserImpl :: UserImpl -> WriterT w m UserImplId Source #

replaceUserImpl :: UserImplId -> UserImpl -> WriterT w m () Source #

deleteUserImpl :: UserImplId -> WriterT w m () Source #

hasPerm :: UserImplId -> Permission -> WriterT w m Bool Source #

getFirstUserByPerm :: Permission -> WriterT w m (Maybe (WithId UserImplId UserImpl)) Source #

selectUserImplGroups :: UserImplId -> WriterT w m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

clearUserImplGroups :: UserImplId -> WriterT w m () Source #

insertAuthUserGroup :: AuthUserGroup -> WriterT w m AuthUserGroupId Source #

insertAuthUserGroupUsers :: AuthUserGroupUsers -> WriterT w m AuthUserGroupUsersId Source #

insertAuthUserGroupPerms :: AuthUserGroupPerms -> WriterT w m AuthUserGroupPermsId Source #

getAuthUserGroup :: AuthUserGroupId -> WriterT w m (Maybe AuthUserGroup) Source #

listAuthUserGroupPermissions :: AuthUserGroupId -> WriterT w m [WithId AuthUserGroupPermsId AuthUserGroupPerms] Source #

listAuthUserGroupUsers :: AuthUserGroupId -> WriterT w m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

replaceAuthUserGroup :: AuthUserGroupId -> AuthUserGroup -> WriterT w m () Source #

clearAuthUserGroupUsers :: AuthUserGroupId -> WriterT w m () Source #

clearAuthUserGroupPerms :: AuthUserGroupId -> WriterT w m () Source #

deleteAuthUserGroup :: AuthUserGroupId -> WriterT w m () Source #

listGroupsPaged :: Page -> PageSize -> WriterT w m ([WithId AuthUserGroupId AuthUserGroup], Word) Source #

setAuthUserGroupName :: AuthUserGroupId -> Text -> WriterT w m () Source #

setAuthUserGroupParent :: AuthUserGroupId -> Maybe AuthUserGroupId -> WriterT w m () Source #

insertSingleUseCode :: UserSingleUseCode -> WriterT w m UserSingleUseCodeId Source #

setSingleUseCodeUsed :: UserSingleUseCodeId -> Maybe UTCTime -> WriterT w m () Source #

getUnusedCode :: SingleUseCode -> UserImplId -> UTCTime -> WriterT w m (Maybe (WithId UserSingleUseCodeId UserSingleUseCode)) Source #

invalidatePermanentCodes :: UserImplId -> UTCTime -> WriterT w m () Source #

selectLastRestoreCode :: UserImplId -> UTCTime -> WriterT w m (Maybe (WithId UserRestoreId UserRestore)) Source #

insertUserRestore :: UserRestore -> WriterT w m UserRestoreId Source #

findRestoreCode :: UserImplId -> RestoreCode -> UTCTime -> WriterT w m (Maybe (WithId UserRestoreId UserRestore)) Source #

replaceRestoreCode :: UserRestoreId -> UserRestore -> WriterT w m () Source #

findAuthToken :: UserImplId -> UTCTime -> WriterT w m (Maybe (WithId AuthTokenId AuthToken)) Source #

findAuthTokenByValue :: SimpleToken -> WriterT w m (Maybe (WithId AuthTokenId AuthToken)) Source #

insertAuthToken :: AuthToken -> WriterT w m AuthTokenId Source #

replaceAuthToken :: AuthTokenId -> AuthToken -> WriterT w m () Source #

HasStorage m => HasStorage (StateT s m) Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Methods

getUserImpl :: UserImplId -> StateT s m (Maybe UserImpl) Source #

getUserImplByLogin :: Login -> StateT s m (Maybe (WithId UserImplId UserImpl)) Source #

listUsersPaged :: Page -> PageSize -> StateT s m ([WithId UserImplId UserImpl], Word) Source #

getUserImplPermissions :: UserImplId -> StateT s m [WithId UserPermId UserPerm] Source #

deleteUserPermissions :: UserImplId -> StateT s m () Source #

insertUserPerm :: UserPerm -> StateT s m UserPermId Source #

insertUserImpl :: UserImpl -> StateT s m UserImplId Source #

replaceUserImpl :: UserImplId -> UserImpl -> StateT s m () Source #

deleteUserImpl :: UserImplId -> StateT s m () Source #

hasPerm :: UserImplId -> Permission -> StateT s m Bool Source #

getFirstUserByPerm :: Permission -> StateT s m (Maybe (WithId UserImplId UserImpl)) Source #

selectUserImplGroups :: UserImplId -> StateT s m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

clearUserImplGroups :: UserImplId -> StateT s m () Source #

insertAuthUserGroup :: AuthUserGroup -> StateT s m AuthUserGroupId Source #

insertAuthUserGroupUsers :: AuthUserGroupUsers -> StateT s m AuthUserGroupUsersId Source #

insertAuthUserGroupPerms :: AuthUserGroupPerms -> StateT s m AuthUserGroupPermsId Source #

getAuthUserGroup :: AuthUserGroupId -> StateT s m (Maybe AuthUserGroup) Source #

listAuthUserGroupPermissions :: AuthUserGroupId -> StateT s m [WithId AuthUserGroupPermsId AuthUserGroupPerms] Source #

listAuthUserGroupUsers :: AuthUserGroupId -> StateT s m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

replaceAuthUserGroup :: AuthUserGroupId -> AuthUserGroup -> StateT s m () Source #

clearAuthUserGroupUsers :: AuthUserGroupId -> StateT s m () Source #

clearAuthUserGroupPerms :: AuthUserGroupId -> StateT s m () Source #

deleteAuthUserGroup :: AuthUserGroupId -> StateT s m () Source #

listGroupsPaged :: Page -> PageSize -> StateT s m ([WithId AuthUserGroupId AuthUserGroup], Word) Source #

setAuthUserGroupName :: AuthUserGroupId -> Text -> StateT s m () Source #

setAuthUserGroupParent :: AuthUserGroupId -> Maybe AuthUserGroupId -> StateT s m () Source #

insertSingleUseCode :: UserSingleUseCode -> StateT s m UserSingleUseCodeId Source #

setSingleUseCodeUsed :: UserSingleUseCodeId -> Maybe UTCTime -> StateT s m () Source #

getUnusedCode :: SingleUseCode -> UserImplId -> UTCTime -> StateT s m (Maybe (WithId UserSingleUseCodeId UserSingleUseCode)) Source #

invalidatePermanentCodes :: UserImplId -> UTCTime -> StateT s m () Source #

selectLastRestoreCode :: UserImplId -> UTCTime -> StateT s m (Maybe (WithId UserRestoreId UserRestore)) Source #

insertUserRestore :: UserRestore -> StateT s m UserRestoreId Source #

findRestoreCode :: UserImplId -> RestoreCode -> UTCTime -> StateT s m (Maybe (WithId UserRestoreId UserRestore)) Source #

replaceRestoreCode :: UserRestoreId -> UserRestore -> StateT s m () Source #

findAuthToken :: UserImplId -> UTCTime -> StateT s m (Maybe (WithId AuthTokenId AuthToken)) Source #

findAuthTokenByValue :: SimpleToken -> StateT s m (Maybe (WithId AuthTokenId AuthToken)) Source #

insertAuthToken :: AuthToken -> StateT s m AuthTokenId Source #

replaceAuthToken :: AuthTokenId -> AuthToken -> StateT s m () Source #

HasStorage m => HasStorage (StateT s m) Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Methods

getUserImpl :: UserImplId -> StateT s m (Maybe UserImpl) Source #

getUserImplByLogin :: Login -> StateT s m (Maybe (WithId UserImplId UserImpl)) Source #

listUsersPaged :: Page -> PageSize -> StateT s m ([WithId UserImplId UserImpl], Word) Source #

getUserImplPermissions :: UserImplId -> StateT s m [WithId UserPermId UserPerm] Source #

deleteUserPermissions :: UserImplId -> StateT s m () Source #

insertUserPerm :: UserPerm -> StateT s m UserPermId Source #

insertUserImpl :: UserImpl -> StateT s m UserImplId Source #

replaceUserImpl :: UserImplId -> UserImpl -> StateT s m () Source #

deleteUserImpl :: UserImplId -> StateT s m () Source #

hasPerm :: UserImplId -> Permission -> StateT s m Bool Source #

getFirstUserByPerm :: Permission -> StateT s m (Maybe (WithId UserImplId UserImpl)) Source #

selectUserImplGroups :: UserImplId -> StateT s m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

clearUserImplGroups :: UserImplId -> StateT s m () Source #

insertAuthUserGroup :: AuthUserGroup -> StateT s m AuthUserGroupId Source #

insertAuthUserGroupUsers :: AuthUserGroupUsers -> StateT s m AuthUserGroupUsersId Source #

insertAuthUserGroupPerms :: AuthUserGroupPerms -> StateT s m AuthUserGroupPermsId Source #

getAuthUserGroup :: AuthUserGroupId -> StateT s m (Maybe AuthUserGroup) Source #

listAuthUserGroupPermissions :: AuthUserGroupId -> StateT s m [WithId AuthUserGroupPermsId AuthUserGroupPerms] Source #

listAuthUserGroupUsers :: AuthUserGroupId -> StateT s m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

replaceAuthUserGroup :: AuthUserGroupId -> AuthUserGroup -> StateT s m () Source #

clearAuthUserGroupUsers :: AuthUserGroupId -> StateT s m () Source #

clearAuthUserGroupPerms :: AuthUserGroupId -> StateT s m () Source #

deleteAuthUserGroup :: AuthUserGroupId -> StateT s m () Source #

listGroupsPaged :: Page -> PageSize -> StateT s m ([WithId AuthUserGroupId AuthUserGroup], Word) Source #

setAuthUserGroupName :: AuthUserGroupId -> Text -> StateT s m () Source #

setAuthUserGroupParent :: AuthUserGroupId -> Maybe AuthUserGroupId -> StateT s m () Source #

insertSingleUseCode :: UserSingleUseCode -> StateT s m UserSingleUseCodeId Source #

setSingleUseCodeUsed :: UserSingleUseCodeId -> Maybe UTCTime -> StateT s m () Source #

getUnusedCode :: SingleUseCode -> UserImplId -> UTCTime -> StateT s m (Maybe (WithId UserSingleUseCodeId UserSingleUseCode)) Source #

invalidatePermanentCodes :: UserImplId -> UTCTime -> StateT s m () Source #

selectLastRestoreCode :: UserImplId -> UTCTime -> StateT s m (Maybe (WithId UserRestoreId UserRestore)) Source #

insertUserRestore :: UserRestore -> StateT s m UserRestoreId Source #

findRestoreCode :: UserImplId -> RestoreCode -> UTCTime -> StateT s m (Maybe (WithId UserRestoreId UserRestore)) Source #

replaceRestoreCode :: UserRestoreId -> UserRestore -> StateT s m () Source #

findAuthToken :: UserImplId -> UTCTime -> StateT s m (Maybe (WithId AuthTokenId AuthToken)) Source #

findAuthTokenByValue :: SimpleToken -> StateT s m (Maybe (WithId AuthTokenId AuthToken)) Source #

insertAuthToken :: AuthToken -> StateT s m AuthTokenId Source #

replaceAuthToken :: AuthTokenId -> AuthToken -> StateT s m () Source #

(HasStorage m, Monoid w) => HasStorage (WriterT w m) Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Methods

getUserImpl :: UserImplId -> WriterT w m (Maybe UserImpl) Source #

getUserImplByLogin :: Login -> WriterT w m (Maybe (WithId UserImplId UserImpl)) Source #

listUsersPaged :: Page -> PageSize -> WriterT w m ([WithId UserImplId UserImpl], Word) Source #

getUserImplPermissions :: UserImplId -> WriterT w m [WithId UserPermId UserPerm] Source #

deleteUserPermissions :: UserImplId -> WriterT w m () Source #

insertUserPerm :: UserPerm -> WriterT w m UserPermId Source #

insertUserImpl :: UserImpl -> WriterT w m UserImplId Source #

replaceUserImpl :: UserImplId -> UserImpl -> WriterT w m () Source #

deleteUserImpl :: UserImplId -> WriterT w m () Source #

hasPerm :: UserImplId -> Permission -> WriterT w m Bool Source #

getFirstUserByPerm :: Permission -> WriterT w m (Maybe (WithId UserImplId UserImpl)) Source #

selectUserImplGroups :: UserImplId -> WriterT w m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

clearUserImplGroups :: UserImplId -> WriterT w m () Source #

insertAuthUserGroup :: AuthUserGroup -> WriterT w m AuthUserGroupId Source #

insertAuthUserGroupUsers :: AuthUserGroupUsers -> WriterT w m AuthUserGroupUsersId Source #

insertAuthUserGroupPerms :: AuthUserGroupPerms -> WriterT w m AuthUserGroupPermsId Source #

getAuthUserGroup :: AuthUserGroupId -> WriterT w m (Maybe AuthUserGroup) Source #

listAuthUserGroupPermissions :: AuthUserGroupId -> WriterT w m [WithId AuthUserGroupPermsId AuthUserGroupPerms] Source #

listAuthUserGroupUsers :: AuthUserGroupId -> WriterT w m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

replaceAuthUserGroup :: AuthUserGroupId -> AuthUserGroup -> WriterT w m () Source #

clearAuthUserGroupUsers :: AuthUserGroupId -> WriterT w m () Source #

clearAuthUserGroupPerms :: AuthUserGroupId -> WriterT w m () Source #

deleteAuthUserGroup :: AuthUserGroupId -> WriterT w m () Source #

listGroupsPaged :: Page -> PageSize -> WriterT w m ([WithId AuthUserGroupId AuthUserGroup], Word) Source #

setAuthUserGroupName :: AuthUserGroupId -> Text -> WriterT w m () Source #

setAuthUserGroupParent :: AuthUserGroupId -> Maybe AuthUserGroupId -> WriterT w m () Source #

insertSingleUseCode :: UserSingleUseCode -> WriterT w m UserSingleUseCodeId Source #

setSingleUseCodeUsed :: UserSingleUseCodeId -> Maybe UTCTime -> WriterT w m () Source #

getUnusedCode :: SingleUseCode -> UserImplId -> UTCTime -> WriterT w m (Maybe (WithId UserSingleUseCodeId UserSingleUseCode)) Source #

invalidatePermanentCodes :: UserImplId -> UTCTime -> WriterT w m () Source #

selectLastRestoreCode :: UserImplId -> UTCTime -> WriterT w m (Maybe (WithId UserRestoreId UserRestore)) Source #

insertUserRestore :: UserRestore -> WriterT w m UserRestoreId Source #

findRestoreCode :: UserImplId -> RestoreCode -> UTCTime -> WriterT w m (Maybe (WithId UserRestoreId UserRestore)) Source #

replaceRestoreCode :: UserRestoreId -> UserRestore -> WriterT w m () Source #

findAuthToken :: UserImplId -> UTCTime -> WriterT w m (Maybe (WithId AuthTokenId AuthToken)) Source #

findAuthTokenByValue :: SimpleToken -> WriterT w m (Maybe (WithId AuthTokenId AuthToken)) Source #

insertAuthToken :: AuthToken -> WriterT w m AuthTokenId Source #

replaceAuthToken :: AuthTokenId -> AuthToken -> WriterT w m () Source #

HasStorage m => HasStorage (ReaderT r m) Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Methods

getUserImpl :: UserImplId -> ReaderT r m (Maybe UserImpl) Source #

getUserImplByLogin :: Login -> ReaderT r m (Maybe (WithId UserImplId UserImpl)) Source #

listUsersPaged :: Page -> PageSize -> ReaderT r m ([WithId UserImplId UserImpl], Word) Source #

getUserImplPermissions :: UserImplId -> ReaderT r m [WithId UserPermId UserPerm] Source #

deleteUserPermissions :: UserImplId -> ReaderT r m () Source #

insertUserPerm :: UserPerm -> ReaderT r m UserPermId Source #

insertUserImpl :: UserImpl -> ReaderT r m UserImplId Source #

replaceUserImpl :: UserImplId -> UserImpl -> ReaderT r m () Source #

deleteUserImpl :: UserImplId -> ReaderT r m () Source #

hasPerm :: UserImplId -> Permission -> ReaderT r m Bool Source #

getFirstUserByPerm :: Permission -> ReaderT r m (Maybe (WithId UserImplId UserImpl)) Source #

selectUserImplGroups :: UserImplId -> ReaderT r m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

clearUserImplGroups :: UserImplId -> ReaderT r m () Source #

insertAuthUserGroup :: AuthUserGroup -> ReaderT r m AuthUserGroupId Source #

insertAuthUserGroupUsers :: AuthUserGroupUsers -> ReaderT r m AuthUserGroupUsersId Source #

insertAuthUserGroupPerms :: AuthUserGroupPerms -> ReaderT r m AuthUserGroupPermsId Source #

getAuthUserGroup :: AuthUserGroupId -> ReaderT r m (Maybe AuthUserGroup) Source #

listAuthUserGroupPermissions :: AuthUserGroupId -> ReaderT r m [WithId AuthUserGroupPermsId AuthUserGroupPerms] Source #

listAuthUserGroupUsers :: AuthUserGroupId -> ReaderT r m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

replaceAuthUserGroup :: AuthUserGroupId -> AuthUserGroup -> ReaderT r m () Source #

clearAuthUserGroupUsers :: AuthUserGroupId -> ReaderT r m () Source #

clearAuthUserGroupPerms :: AuthUserGroupId -> ReaderT r m () Source #

deleteAuthUserGroup :: AuthUserGroupId -> ReaderT r m () Source #

listGroupsPaged :: Page -> PageSize -> ReaderT r m ([WithId AuthUserGroupId AuthUserGroup], Word) Source #

setAuthUserGroupName :: AuthUserGroupId -> Text -> ReaderT r m () Source #

setAuthUserGroupParent :: AuthUserGroupId -> Maybe AuthUserGroupId -> ReaderT r m () Source #

insertSingleUseCode :: UserSingleUseCode -> ReaderT r m UserSingleUseCodeId Source #

setSingleUseCodeUsed :: UserSingleUseCodeId -> Maybe UTCTime -> ReaderT r m () Source #

getUnusedCode :: SingleUseCode -> UserImplId -> UTCTime -> ReaderT r m (Maybe (WithId UserSingleUseCodeId UserSingleUseCode)) Source #

invalidatePermanentCodes :: UserImplId -> UTCTime -> ReaderT r m () Source #

selectLastRestoreCode :: UserImplId -> UTCTime -> ReaderT r m (Maybe (WithId UserRestoreId UserRestore)) Source #

insertUserRestore :: UserRestore -> ReaderT r m UserRestoreId Source #

findRestoreCode :: UserImplId -> RestoreCode -> UTCTime -> ReaderT r m (Maybe (WithId UserRestoreId UserRestore)) Source #

replaceRestoreCode :: UserRestoreId -> UserRestore -> ReaderT r m () Source #

findAuthToken :: UserImplId -> UTCTime -> ReaderT r m (Maybe (WithId AuthTokenId AuthToken)) Source #

findAuthTokenByValue :: SimpleToken -> ReaderT r m (Maybe (WithId AuthTokenId AuthToken)) Source #

insertAuthToken :: AuthToken -> ReaderT r m AuthTokenId Source #

replaceAuthToken :: AuthTokenId -> AuthToken -> ReaderT r m () Source #

HasStorage m => HasStorage (ContT r m) Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Methods

getUserImpl :: UserImplId -> ContT r m (Maybe UserImpl) Source #

getUserImplByLogin :: Login -> ContT r m (Maybe (WithId UserImplId UserImpl)) Source #

listUsersPaged :: Page -> PageSize -> ContT r m ([WithId UserImplId UserImpl], Word) Source #

getUserImplPermissions :: UserImplId -> ContT r m [WithId UserPermId UserPerm] Source #

deleteUserPermissions :: UserImplId -> ContT r m () Source #

insertUserPerm :: UserPerm -> ContT r m UserPermId Source #

insertUserImpl :: UserImpl -> ContT r m UserImplId Source #

replaceUserImpl :: UserImplId -> UserImpl -> ContT r m () Source #

deleteUserImpl :: UserImplId -> ContT r m () Source #

hasPerm :: UserImplId -> Permission -> ContT r m Bool Source #

getFirstUserByPerm :: Permission -> ContT r m (Maybe (WithId UserImplId UserImpl)) Source #

selectUserImplGroups :: UserImplId -> ContT r m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

clearUserImplGroups :: UserImplId -> ContT r m () Source #

insertAuthUserGroup :: AuthUserGroup -> ContT r m AuthUserGroupId Source #

insertAuthUserGroupUsers :: AuthUserGroupUsers -> ContT r m AuthUserGroupUsersId Source #

insertAuthUserGroupPerms :: AuthUserGroupPerms -> ContT r m AuthUserGroupPermsId Source #

getAuthUserGroup :: AuthUserGroupId -> ContT r m (Maybe AuthUserGroup) Source #

listAuthUserGroupPermissions :: AuthUserGroupId -> ContT r m [WithId AuthUserGroupPermsId AuthUserGroupPerms] Source #

listAuthUserGroupUsers :: AuthUserGroupId -> ContT r m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

replaceAuthUserGroup :: AuthUserGroupId -> AuthUserGroup -> ContT r m () Source #

clearAuthUserGroupUsers :: AuthUserGroupId -> ContT r m () Source #

clearAuthUserGroupPerms :: AuthUserGroupId -> ContT r m () Source #

deleteAuthUserGroup :: AuthUserGroupId -> ContT r m () Source #

listGroupsPaged :: Page -> PageSize -> ContT r m ([WithId AuthUserGroupId AuthUserGroup], Word) Source #

setAuthUserGroupName :: AuthUserGroupId -> Text -> ContT r m () Source #

setAuthUserGroupParent :: AuthUserGroupId -> Maybe AuthUserGroupId -> ContT r m () Source #

insertSingleUseCode :: UserSingleUseCode -> ContT r m UserSingleUseCodeId Source #

setSingleUseCodeUsed :: UserSingleUseCodeId -> Maybe UTCTime -> ContT r m () Source #

getUnusedCode :: SingleUseCode -> UserImplId -> UTCTime -> ContT r m (Maybe (WithId UserSingleUseCodeId UserSingleUseCode)) Source #

invalidatePermanentCodes :: UserImplId -> UTCTime -> ContT r m () Source #

selectLastRestoreCode :: UserImplId -> UTCTime -> ContT r m (Maybe (WithId UserRestoreId UserRestore)) Source #

insertUserRestore :: UserRestore -> ContT r m UserRestoreId Source #

findRestoreCode :: UserImplId -> RestoreCode -> UTCTime -> ContT r m (Maybe (WithId UserRestoreId UserRestore)) Source #

replaceRestoreCode :: UserRestoreId -> UserRestore -> ContT r m () Source #

findAuthToken :: UserImplId -> UTCTime -> ContT r m (Maybe (WithId AuthTokenId AuthToken)) Source #

findAuthTokenByValue :: SimpleToken -> ContT r m (Maybe (WithId AuthTokenId AuthToken)) Source #

insertAuthToken :: AuthToken -> ContT r m AuthTokenId Source #

replaceAuthToken :: AuthTokenId -> AuthToken -> ContT r m () Source #

(HasStorage m, Monoid w) => HasStorage (RWST r w s m) Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Methods

getUserImpl :: UserImplId -> RWST r w s m (Maybe UserImpl) Source #

getUserImplByLogin :: Login -> RWST r w s m (Maybe (WithId UserImplId UserImpl)) Source #

listUsersPaged :: Page -> PageSize -> RWST r w s m ([WithId UserImplId UserImpl], Word) Source #

getUserImplPermissions :: UserImplId -> RWST r w s m [WithId UserPermId UserPerm] Source #

deleteUserPermissions :: UserImplId -> RWST r w s m () Source #

insertUserPerm :: UserPerm -> RWST r w s m UserPermId Source #

insertUserImpl :: UserImpl -> RWST r w s m UserImplId Source #

replaceUserImpl :: UserImplId -> UserImpl -> RWST r w s m () Source #

deleteUserImpl :: UserImplId -> RWST r w s m () Source #

hasPerm :: UserImplId -> Permission -> RWST r w s m Bool Source #

getFirstUserByPerm :: Permission -> RWST r w s m (Maybe (WithId UserImplId UserImpl)) Source #

selectUserImplGroups :: UserImplId -> RWST r w s m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

clearUserImplGroups :: UserImplId -> RWST r w s m () Source #

insertAuthUserGroup :: AuthUserGroup -> RWST r w s m AuthUserGroupId Source #

insertAuthUserGroupUsers :: AuthUserGroupUsers -> RWST r w s m AuthUserGroupUsersId Source #

insertAuthUserGroupPerms :: AuthUserGroupPerms -> RWST r w s m AuthUserGroupPermsId Source #

getAuthUserGroup :: AuthUserGroupId -> RWST r w s m (Maybe AuthUserGroup) Source #

listAuthUserGroupPermissions :: AuthUserGroupId -> RWST r w s m [WithId AuthUserGroupPermsId AuthUserGroupPerms] Source #

listAuthUserGroupUsers :: AuthUserGroupId -> RWST r w s m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

replaceAuthUserGroup :: AuthUserGroupId -> AuthUserGroup -> RWST r w s m () Source #

clearAuthUserGroupUsers :: AuthUserGroupId -> RWST r w s m () Source #

clearAuthUserGroupPerms :: AuthUserGroupId -> RWST r w s m () Source #

deleteAuthUserGroup :: AuthUserGroupId -> RWST r w s m () Source #

listGroupsPaged :: Page -> PageSize -> RWST r w s m ([WithId AuthUserGroupId AuthUserGroup], Word) Source #

setAuthUserGroupName :: AuthUserGroupId -> Text -> RWST r w s m () Source #

setAuthUserGroupParent :: AuthUserGroupId -> Maybe AuthUserGroupId -> RWST r w s m () Source #

insertSingleUseCode :: UserSingleUseCode -> RWST r w s m UserSingleUseCodeId Source #

setSingleUseCodeUsed :: UserSingleUseCodeId -> Maybe UTCTime -> RWST r w s m () Source #

getUnusedCode :: SingleUseCode -> UserImplId -> UTCTime -> RWST r w s m (Maybe (WithId UserSingleUseCodeId UserSingleUseCode)) Source #

invalidatePermanentCodes :: UserImplId -> UTCTime -> RWST r w s m () Source #

selectLastRestoreCode :: UserImplId -> UTCTime -> RWST r w s m (Maybe (WithId UserRestoreId UserRestore)) Source #

insertUserRestore :: UserRestore -> RWST r w s m UserRestoreId Source #

findRestoreCode :: UserImplId -> RestoreCode -> UTCTime -> RWST r w s m (Maybe (WithId UserRestoreId UserRestore)) Source #

replaceRestoreCode :: UserRestoreId -> UserRestore -> RWST r w s m () Source #

findAuthToken :: UserImplId -> UTCTime -> RWST r w s m (Maybe (WithId AuthTokenId AuthToken)) Source #

findAuthTokenByValue :: SimpleToken -> RWST r w s m (Maybe (WithId AuthTokenId AuthToken)) Source #

insertAuthToken :: AuthToken -> RWST r w s m AuthTokenId Source #

replaceAuthToken :: AuthTokenId -> AuthToken -> RWST r w s m () Source #

(HasStorage m, Monoid w) => HasStorage (RWST r w s m) Source # 
Instance details

Defined in Servant.Server.Auth.Token.Model

Methods

getUserImpl :: UserImplId -> RWST r w s m (Maybe UserImpl) Source #

getUserImplByLogin :: Login -> RWST r w s m (Maybe (WithId UserImplId UserImpl)) Source #

listUsersPaged :: Page -> PageSize -> RWST r w s m ([WithId UserImplId UserImpl], Word) Source #

getUserImplPermissions :: UserImplId -> RWST r w s m [WithId UserPermId UserPerm] Source #

deleteUserPermissions :: UserImplId -> RWST r w s m () Source #

insertUserPerm :: UserPerm -> RWST r w s m UserPermId Source #

insertUserImpl :: UserImpl -> RWST r w s m UserImplId Source #

replaceUserImpl :: UserImplId -> UserImpl -> RWST r w s m () Source #

deleteUserImpl :: UserImplId -> RWST r w s m () Source #

hasPerm :: UserImplId -> Permission -> RWST r w s m Bool Source #

getFirstUserByPerm :: Permission -> RWST r w s m (Maybe (WithId UserImplId UserImpl)) Source #

selectUserImplGroups :: UserImplId -> RWST r w s m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

clearUserImplGroups :: UserImplId -> RWST r w s m () Source #

insertAuthUserGroup :: AuthUserGroup -> RWST r w s m AuthUserGroupId Source #

insertAuthUserGroupUsers :: AuthUserGroupUsers -> RWST r w s m AuthUserGroupUsersId Source #

insertAuthUserGroupPerms :: AuthUserGroupPerms -> RWST r w s m AuthUserGroupPermsId Source #

getAuthUserGroup :: AuthUserGroupId -> RWST r w s m (Maybe AuthUserGroup) Source #

listAuthUserGroupPermissions :: AuthUserGroupId -> RWST r w s m [WithId AuthUserGroupPermsId AuthUserGroupPerms] Source #

listAuthUserGroupUsers :: AuthUserGroupId -> RWST r w s m [WithId AuthUserGroupUsersId AuthUserGroupUsers] Source #

replaceAuthUserGroup :: AuthUserGroupId -> AuthUserGroup -> RWST r w s m () Source #

clearAuthUserGroupUsers :: AuthUserGroupId -> RWST r w s m () Source #

clearAuthUserGroupPerms :: AuthUserGroupId -> RWST r w s m () Source #

deleteAuthUserGroup :: AuthUserGroupId -> RWST r w s m () Source #

listGroupsPaged :: Page -> PageSize -> RWST r w s m ([WithId AuthUserGroupId AuthUserGroup], Word) Source #

setAuthUserGroupName :: AuthUserGroupId -> Text -> RWST r w s m () Source #

setAuthUserGroupParent :: AuthUserGroupId -> Maybe AuthUserGroupId -> RWST r w s m () Source #

insertSingleUseCode :: UserSingleUseCode -> RWST r w s m UserSingleUseCodeId Source #

setSingleUseCodeUsed :: UserSingleUseCodeId -> Maybe UTCTime -> RWST r w s m () Source #

getUnusedCode :: SingleUseCode -> UserImplId -> UTCTime -> RWST r w s m (Maybe (WithId UserSingleUseCodeId UserSingleUseCode)) Source #

invalidatePermanentCodes :: UserImplId -> UTCTime -> RWST r w s m () Source #

selectLastRestoreCode :: UserImplId -> UTCTime -> RWST r w s m (Maybe (WithId UserRestoreId UserRestore)) Source #

insertUserRestore :: UserRestore -> RWST r w s m UserRestoreId Source #

findRestoreCode :: UserImplId -> RestoreCode -> UTCTime -> RWST r w s m (Maybe (WithId UserRestoreId UserRestore)) Source #

replaceRestoreCode :: UserRestoreId -> UserRestore -> RWST r w s m () Source #

findAuthToken :: UserImplId -> UTCTime -> RWST r w s m (Maybe (WithId AuthTokenId AuthToken)) Source #

findAuthTokenByValue :: SimpleToken -> RWST r w s m (Maybe (WithId AuthTokenId AuthToken)) Source #

insertAuthToken :: AuthToken -> RWST r w s m AuthTokenId Source #

replaceAuthToken :: AuthTokenId -> AuthToken -> RWST r w s m () Source #

Operations

passToByteString :: Password -> ByteString Source #

Convert password to bytestring

byteStringToPass :: ByteString -> Password Source #

Convert bytestring into password

User

userToUserInfo :: WithId UserImplId UserImpl -> [Permission] -> [UserGroupId] -> RespUserInfo Source #

Helper to convert user to response

readUserInfo :: HasStorage m => UserId -> m (Maybe RespUserInfo) Source #

Get user by id

getUserPermissions :: HasStorage m => UserImplId -> m [Permission] Source #

Return list of permissions for the given user (only permissions that are assigned to him directly)

setUserPermissions :: HasStorage m => UserImplId -> [Permission] -> m () Source #

Return list of permissions for the given user

createUser :: HasStorage m => Int -> Login -> Password -> Email -> [Permission] -> m UserImplId Source #

Creation of new user

hasPerms :: HasStorage m => UserImplId -> [Permission] -> m Bool Source #

Check whether the user has particular permissions

createAdmin :: HasStorage m => Int -> Login -> Password -> Email -> m UserImplId Source #

Creates user with admin privileges

ensureAdmin :: HasStorage m => Int -> Login -> Password -> Email -> m () Source #

Ensures that DB has at leas one admin, if not, creates a new one with specified info.

patchUser Source #

Arguments

:: HasStorage m 
=> Int

Password strength

-> PatchUser 
-> WithId UserImplId UserImpl 
-> m (WithId UserImplId UserImpl) 

Apply patches for user

setUserPassword' Source #

Arguments

:: MonadIO m 
=> Int

Password strength

-> Password 
-> UserImpl 
-> m UserImpl 

Update password of user

User groups

getUserGroups :: HasStorage m => UserImplId -> m [UserGroupId] Source #

Get all groups the user belongs to

setUserGroups :: HasStorage m => UserImplId -> [UserGroupId] -> m () Source #

Rewrite all user groups

validateGroups :: HasStorage m => [UserGroupId] -> m [AuthUserGroupId] Source #

Leave only existing groups

getGroupPermissions :: HasStorage m => UserGroupId -> m [Permission] Source #

Getting permission of a group and all it parent groups

getUserGroupPermissions :: HasStorage m => UserImplId -> m [Permission] Source #

Get user permissions that are assigned to him/her via groups only

getUserAllPermissions :: HasStorage m => UserImplId -> m [Permission] Source #

Get user permissions that are assigned to him/her either by direct way or by his/her groups.

readUserGroup :: HasStorage m => UserGroupId -> m (Maybe UserGroup) Source #

Collect full info about user group from RDBMS

toAuthUserGroup :: UserGroup -> (AuthUserGroup, AuthUserGroupId -> [AuthUserGroupUsers], AuthUserGroupId -> [AuthUserGroupPerms]) Source #

Helper to convert user group into values of several tables

insertUserGroup :: HasStorage m => UserGroup -> m UserGroupId Source #

Insert user group into RDBMS

updateUserGroup :: HasStorage m => UserGroupId -> UserGroup -> m () Source #

Replace user group with new value

deleteUserGroup :: HasStorage m => UserGroupId -> m () Source #

Erase user group from RDBMS, cascade

patchUserGroup :: HasStorage m => UserGroupId -> PatchUserGroup -> m () Source #

Partial update of user group

Low-level

makeUserInfo :: HasStorage m => WithId UserImplId UserImpl -> m RespUserInfo Source #

Low level operation for collecting info about user