add insert of default administrator role
This commit is contained in:
parent
c98487318a
commit
fafa684da4
2 changed files with 30 additions and 0 deletions
|
@ -91,6 +91,7 @@ main = do
|
|||
void $ execute_ conn initJournal
|
||||
void $ execute_ conn initRole
|
||||
void $ execute_ conn initUserToRole
|
||||
runInsertInitialRole
|
||||
forkCleanProcess conn store
|
||||
withStdoutLogger $ \ilog -> do
|
||||
let settings = setPort (fromIntegral lport) $
|
||||
|
|
|
@ -100,3 +100,32 @@ userToRoleTable = table "user_to_role" (
|
|||
, tableField "role_id"
|
||||
)
|
||||
)
|
||||
|
||||
insertInitialRole :: PGS.Connection -> MateHandler ()
|
||||
insertInitialRole conn =
|
||||
liftIO $ runInsertInitalRole conn
|
||||
|
||||
runInsertInitalRole :: PGS.Connection -> IO ()
|
||||
runInsertInitalRole conn =
|
||||
runInsert_ conn $ Insert
|
||||
{ iTable = roleTable
|
||||
, iRows =
|
||||
[
|
||||
( C.constant (Nothing :: Maybe Int)
|
||||
, C.constant "Administrator"
|
||||
, C.constant True
|
||||
, C.constant True
|
||||
, C.constant True
|
||||
, C.constant True
|
||||
, C.constant True
|
||||
, C.constant True
|
||||
, C.constant True
|
||||
, C.constant True
|
||||
, C.constant True
|
||||
, C.constant True
|
||||
, C.constant True
|
||||
)
|
||||
]
|
||||
, iReturning = rReturning (\(id_, _, _, _, _, _, _, _, _, _, _, _, _) -> id_)
|
||||
, iOnConflict = Nothing
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue