From cad5239b872ce1ddb0d1178b28f0517460dc6c7e Mon Sep 17 00:00:00 2001 From: nek0 Date: Thu, 1 Oct 2020 19:11:52 +0200 Subject: [PATCH] stuff --- src/Control/Journal.hs | 3 ++- src/Types/Settings.hs | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/Types/Settings.hs diff --git a/src/Control/Journal.hs b/src/Control/Journal.hs index a234b70..37690df 100644 --- a/src/Control/Journal.hs +++ b/src/Control/Journal.hs @@ -19,7 +19,8 @@ journalShow -> Maybe Int -> MateHandler [JournalEntry] journalShow (Just (uid, method)) mlimit moffset = do - if method `elem` [PrimaryPass, ChallengeResponse] + maySeeJournal <- checkCapability uid roleCanManageJournal + if method `elem` [PrimaryPass, ChallengeResponse] && maySeeJournal then do conn <- asks rsConnection selectJournalEntries mlimit moffset conn diff --git a/src/Types/Settings.hs b/src/Types/Settings.hs new file mode 100644 index 0000000..1c142ba --- /dev/null +++ b/src/Types/Settings.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE TypeFamilies #-} +module Types.Settings where + +import qualified Data.Text as T + +data Settings = Settings + { settingsCurrency :: T.Text + , settingsDecimalPlaces :: Int + , settingsBlockRegistration :: Bool + } + +instance ToDatabase Settings where + + data InTuple Settings = (T.Text, Int, Bool) + + toDatabase (Settings currency places reg) = (currency, places, reg) + +instance FromDatabase Settins where + + data OutTuple Settings = (T.Text, Int, Bool) + + fromDatabase (currency, places, reg) = Settings currency places reg