From 0bde8d5888934ff5ba0eedab21ce98f4f9844912 Mon Sep 17 00:00:00 2001 From: SJost Date: Wed, 30 Jan 2019 19:27:10 +0100 Subject: [PATCH 1/2] Fast Bugfix: course Register from --- messages/uniworx/de.msg | 2 +- src/Foundation.hs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/messages/uniworx/de.msg b/messages/uniworx/de.msg index c7c7f8574..be30c01cf 100644 --- a/messages/uniworx/de.msg +++ b/messages/uniworx/de.msg @@ -70,7 +70,7 @@ CourseSemester: Semester CourseSchool: Institut CourseSchoolShort: Fach CourseSecretTip: Anmeldung zum Kurs erfordert Eingabe des Passworts, sofern gesetzt -CourseRegisterFromTip: Ohne Datum ist keine eigenständige Anmeldung von Studierenden möglich +CourseRegisterFromTip: Ohne Datum ist KEINE eigenständige Anmeldung von Studierenden möglich CourseRegisterToTip: Anmeldung darf auch ohne Begrenzung möglich sein CourseDeregisterUntilTip: Abmeldung darf auch ohne Begrenzung möglich sein CourseFilterSearch: Volltext-Suche diff --git a/src/Foundation.hs b/src/Foundation.hs index 9ac8fb834..c77329d52 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -473,7 +473,7 @@ tagAccessPredicate AuthTime = APDB $ \route _ -> case route of case mbc of (Just (Entity _ Course{courseRegisterFrom, courseRegisterTo})) | not registered - , courseRegisterFrom <= nBot cTime + , NTop courseRegisterFrom <= cTime -- Nothing => always False! , NTop courseRegisterTo >= cTime -> return Authorized (Just (Entity _ Course{courseDeregisterUntil})) | registered @@ -1459,7 +1459,7 @@ pageActions (CSubmissionR tid ssh csh shn cid SubShowR) = , MenuItem { menuItemType = PageActionSecondary , menuItemLabel = MsgMenuSubmissionDelete - , menuItemIcon = Nothing + , menuItemIcon = Just "trash" , menuItemRoute = SomeRoute $ CSubmissionR tid ssh csh shn cid SubDelR , menuItemModal = False , menuItemAccessCallback' = return True From 36813d3717af47db383962def80dc3a77a381856 Mon Sep 17 00:00:00 2001 From: SJost Date: Thu, 31 Jan 2019 18:25:41 +0100 Subject: [PATCH 2/2] Refactored Access check to CRegisterR without NTop for clarity --- src/Foundation.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Foundation.hs b/src/Foundation.hs index c77329d52..8d338c7f0 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -464,20 +464,21 @@ tagAccessPredicate AuthTime = APDB $ \route _ -> case route of return Authorized CourseR tid ssh csh CRegisterR -> do + now <- liftIO getCurrentTime mbc <- getBy $ TermSchoolCourseShort tid ssh csh mAid <- lift maybeAuthId registered <- case (mbc,mAid) of (Just (Entity cid _), Just uid) -> isJust <$> (getBy $ UniqueParticipant uid cid) _ -> return False - cTime <- (NTop . Just) <$> liftIO getCurrentTime case mbc of (Just (Entity _ Course{courseRegisterFrom, courseRegisterTo})) | not registered - , NTop courseRegisterFrom <= cTime -- Nothing => always False! - , NTop courseRegisterTo >= cTime -> return Authorized + , Just regFrom <- courseRegisterFrom -- Nothing = no registration + , regFrom <= now + , maybe True (now <=) courseRegisterTo -> return Authorized (Just (Entity _ Course{courseDeregisterUntil})) | registered - , NTop courseDeregisterUntil >= cTime -> return Authorized + , maybe True (now <=) courseDeregisterUntil -> return Authorized _other -> unauthorizedI MsgUnauthorizedCourseTime MessageR cID -> maybeT (unauthorizedI MsgUnauthorizedSystemMessageTime) $ do