From 15689c597ef407583b01dabc9f7631e9dc90b009 Mon Sep 17 00:00:00 2001 From: ros Date: Mon, 5 Jul 2021 12:53:17 +0200 Subject: [PATCH 1/6] feat(course admin): done --- messages/uniworx/categories/courses/courses/de-de-formal.msg | 3 ++- messages/uniworx/categories/courses/courses/en-eu.msg | 1 + src/Application.hs | 1 + src/Model/Types/Course.hs | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/messages/uniworx/categories/courses/courses/de-de-formal.msg b/messages/uniworx/categories/courses/courses/de-de-formal.msg index fb33d8c9f..cb324e1dc 100644 --- a/messages/uniworx/categories/courses/courses/de-de-formal.msg +++ b/messages/uniworx/categories/courses/courses/de-de-formal.msg @@ -277,4 +277,5 @@ MailSubjectLecturerInvitation tid@TermId ssh@SchoolId csh@CourseShorthand: [#{ti LecturerInvitationAccepted lType@Text csh@CourseShorthand: Sie wurden als #{lType} für #{csh} eingetragen CourseExamRegistrationTime: Angemeldet seit CourseParticipantStateIsActiveFilter: Ansicht -CourseApply: Zum Kurs bewerben \ No newline at end of file +CourseApply: Zum Kurs bewerben +CourseAdministrator: Administrator:in \ No newline at end of file diff --git a/messages/uniworx/categories/courses/courses/en-eu.msg b/messages/uniworx/categories/courses/courses/en-eu.msg index d3e3d709f..96c84588f 100644 --- a/messages/uniworx/categories/courses/courses/en-eu.msg +++ b/messages/uniworx/categories/courses/courses/en-eu.msg @@ -277,3 +277,4 @@ LecturerInvitationAccepted lType csh: You were registered as #{lType} for #{csh} CourseExamRegistrationTime: Registered since CourseParticipantStateIsActiveFilter: View CourseApply: Apply for course +CourseAdministrator: Administrator \ No newline at end of file diff --git a/src/Application.hs b/src/Application.hs index 0c0fcbbd5..426fc930d 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -710,3 +710,4 @@ addPWEntry User{ userAuthentication = _, ..} (Text.encodeUtf8 -> pw) = db' $ do PWHashConf{..} <- getsYesod $ view _appAuthPWHash (AuthPWHash . Text.decodeUtf8 -> userAuthentication) <- liftIO $ makePasswordWith pwHashAlgorithm pw pwHashStrength void $ insert User{..} + diff --git a/src/Model/Types/Course.hs b/src/Model/Types/Course.hs index e9779a486..7ede7a7e7 100644 --- a/src/Model/Types/Course.hs +++ b/src/Model/Types/Course.hs @@ -14,7 +14,7 @@ import Model.Types.TH.PathPiece import Utils.Lens.TH -data LecturerType = CourseLecturer | CourseAssistant +data LecturerType = CourseLecturer | CourseAssistant | CourseAdministrator deriving (Eq, Ord, Read, Show, Enum, Bounded, Generic, Typeable) deriving (Universe, Finite, NFData) From 89e1d675c3be0fec106e84920184a8c95dfa6346 Mon Sep 17 00:00:00 2001 From: ros Date: Thu, 8 Jul 2021 11:01:09 +0200 Subject: [PATCH 2/6] feat(lecturer type): aenderung --- src/Handler/Tutorial/List.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Handler/Tutorial/List.hs b/src/Handler/Tutorial/List.hs index 39f67c0e8..b49eea883 100644 --- a/src/Handler/Tutorial/List.hs +++ b/src/Handler/Tutorial/List.hs @@ -42,7 +42,7 @@ getCTutorialListR tid ssh csh = do dbtColonnade = dbColonnade $ mconcat [ sortable (Just "type") (i18nCell MsgTableTutorialType) $ \(view $ resultTutorial . _entityVal -> Tutorial{..}) -> textCell $ CI.original tutorialType , sortable (Just "name") (i18nCell MsgTableTutorialName) $ \(view $ resultTutorial . _entityVal -> Tutorial{..}) -> anchorCell (CTutorialR tid ssh csh tutorialName TUsersR) [whamlet|#{tutorialName}|] - , sortable Nothing (i18nCell MsgTableTutorialTutors) $ \(view $ resultTutorial . _entityKey -> tutid) -> sqlCell $ do + , sortable (Just "tutors") (i18nCell MsgTableTutorialTutors) $ \(view $ resultTutorial . _entityKey -> tutid) -> sqlCell $ do tutors <- fmap (map $(unValueN 3)) . E.select . E.from $ \(tutor `E.InnerJoin` user) -> do E.on $ tutor E.^. TutorUser E.==. user E.^. UserId E.where_ $ tutor E.^. TutorTutorial E.==. E.val tutid From 0a6a1749d351e626383e513293af280f78552009 Mon Sep 17 00:00:00 2001 From: ros Date: Thu, 22 Jul 2021 21:01:54 +0200 Subject: [PATCH 3/6] feat(course admin): no new-line --- src/Application.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Application.hs b/src/Application.hs index 426fc930d..001d87096 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -709,5 +709,4 @@ addPWEntry :: User addPWEntry User{ userAuthentication = _, ..} (Text.encodeUtf8 -> pw) = db' $ do PWHashConf{..} <- getsYesod $ view _appAuthPWHash (AuthPWHash . Text.decodeUtf8 -> userAuthentication) <- liftIO $ makePasswordWith pwHashAlgorithm pw pwHashStrength - void $ insert User{..} - + void $ insert User{..} \ No newline at end of file From 26e638dfd777b04161e0da026a532d4446ae3c0f Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Thu, 12 Aug 2021 12:02:58 +0200 Subject: [PATCH 4/6] Apply 1 suggestion(s) to 1 file(s) --- messages/uniworx/categories/courses/courses/en-eu.msg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messages/uniworx/categories/courses/courses/en-eu.msg b/messages/uniworx/categories/courses/courses/en-eu.msg index 96c84588f..da740b3ae 100644 --- a/messages/uniworx/categories/courses/courses/en-eu.msg +++ b/messages/uniworx/categories/courses/courses/en-eu.msg @@ -277,4 +277,4 @@ LecturerInvitationAccepted lType csh: You were registered as #{lType} for #{csh} CourseExamRegistrationTime: Registered since CourseParticipantStateIsActiveFilter: View CourseApply: Apply for course -CourseAdministrator: Administrator \ No newline at end of file +CourseAdministrator: Course administrator \ No newline at end of file From e2d43fd0dea3a8b150413856787f6b43f5ead40b Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Thu, 12 Aug 2021 12:03:04 +0200 Subject: [PATCH 5/6] Apply 1 suggestion(s) to 1 file(s) --- messages/uniworx/categories/courses/courses/de-de-formal.msg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messages/uniworx/categories/courses/courses/de-de-formal.msg b/messages/uniworx/categories/courses/courses/de-de-formal.msg index cb324e1dc..2334163bc 100644 --- a/messages/uniworx/categories/courses/courses/de-de-formal.msg +++ b/messages/uniworx/categories/courses/courses/de-de-formal.msg @@ -278,4 +278,4 @@ LecturerInvitationAccepted lType@Text csh@CourseShorthand: Sie wurden als #{lTyp CourseExamRegistrationTime: Angemeldet seit CourseParticipantStateIsActiveFilter: Ansicht CourseApply: Zum Kurs bewerben -CourseAdministrator: Administrator:in \ No newline at end of file +CourseAdministrator: Kursadministrator:in \ No newline at end of file From cb4ed8d9887e521f47689c118baf439846cd4514 Mon Sep 17 00:00:00 2001 From: ros Date: Tue, 17 Aug 2021 11:42:14 +0200 Subject: [PATCH 6/6] feat(course admin): application restore --- src/Application.hs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Application.hs b/src/Application.hs index 001d87096..7d02e6009 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -116,6 +116,8 @@ import qualified Utils.Pool as Custom import Utils.Postgresql import Handler.Utils.Memcached (manageMemcachedLocalInvalidations) +import qualified System.Clock as Clock + -- Import all relevant handler modules here. -- (HPack takes care to add new modules to our cabal file nowadays.) import Handler.News @@ -213,7 +215,7 @@ makeFoundation appSettings''@AppSettings{..} = do -- from there, and then create the real foundation. let mkFoundation :: _ -> (forall m. MonadIO m => Custom.Pool' m DBConnLabel DBConnUseState SqlBackend) -> _ - mkFoundation appSettings' appConnPool appSmtpPool appLdapPool appCryptoIDKey appSessionStore appSecretBoxKey appWidgetMemcached appJSONWebKeySet appClusterID appMemcached appMemcachedLocal appUploadCache appVerpSecret appAuthKey = UniWorX {..} + mkFoundation appSettings' appConnPool appSmtpPool appLdapPool appCryptoIDKey appSessionStore appSecretBoxKey appWidgetMemcached appJSONWebKeySet appClusterID appMemcached appMemcachedLocal appUploadCache appVerpSecret appAuthKey appPersonalisedSheetFilesSeedKey appVolatileClusterSettingsCache = UniWorX {..} -- The UniWorX {..} syntax is an example of record wild cards. For more -- information, see: -- https://ocharles.org.uk/blog/posts/2014-12-04-record-wildcards.html @@ -233,6 +235,8 @@ makeFoundation appSettings''@AppSettings{..} = do (error "MinioConn forced in tempFoundation") (error "VerpSecret forced in tempFoundation") (error "AuthKey forced in tempFoundation") + (error "PersonalisedSheetFilesSeedKey forced in tempFoundation") + (error "VolatileClusterSettingsCache forced in tempFoundation") runAppLoggingT tempFoundation $ do $logInfoS "InstanceID" $ UUID.toText appInstanceID @@ -293,6 +297,11 @@ makeFoundation appSettings''@AppSettings{..} = do appClusterID <- clusterSetting (Proxy :: Proxy 'ClusterId) `customRunSqlPool` sqlPool appVerpSecret <- clusterSetting (Proxy :: Proxy 'ClusterVerpSecret) `customRunSqlPool` sqlPool appAuthKey <- clusterSetting (Proxy :: Proxy 'ClusterAuthKey) `customRunSqlPool` sqlPool + appPersonalisedSheetFilesSeedKey <- clusterSetting (Proxy :: Proxy 'ClusterPersonalisedSheetFilesSeedKey) `customRunSqlPool` sqlPool + + let appVolatileClusterSettingsCacheTime' = Clock.fromNanoSecs ns + where (MkFixed ns :: Nano) = realToFrac appVolatileClusterSettingsCacheTime + appVolatileClusterSettingsCache <- newTVarIO $ mkVolatileClusterSettingsCache appVolatileClusterSettingsCacheTime' needsRechunk <- exists [FileContentChunkContentBased !=. True] `customRunSqlPool` sqlPool let appSettings' = appSettings'' @@ -326,7 +335,7 @@ makeFoundation appSettings''@AppSettings{..} = do $logDebugS "Runtime configuration" $ tshow appSettings' - let foundation = mkFoundation appSettings' sqlPool smtpPool ldapPool appCryptoIDKey appSessionStore appSecretBoxKey appWidgetMemcached appJSONWebKeySet appClusterID appMemcached appMemcachedLocal appUploadCache appVerpSecret appAuthKey + let foundation = mkFoundation appSettings' sqlPool smtpPool ldapPool appCryptoIDKey appSessionStore appSecretBoxKey appWidgetMemcached appJSONWebKeySet appClusterID appMemcached appMemcachedLocal appUploadCache appVerpSecret appAuthKey appPersonalisedSheetFilesSeedKey appVolatileClusterSettingsCache -- Return the foundation $logDebugS "setup" "Done" @@ -709,4 +718,4 @@ addPWEntry :: User addPWEntry User{ userAuthentication = _, ..} (Text.encodeUtf8 -> pw) = db' $ do PWHashConf{..} <- getsYesod $ view _appAuthPWHash (AuthPWHash . Text.decodeUtf8 -> userAuthentication) <- liftIO $ makePasswordWith pwHashAlgorithm pw pwHashStrength - void $ insert User{..} \ No newline at end of file + void $ insert User{..}