From 9bad1b42ecce6ad1fd2dfc84642eb0cce236109b Mon Sep 17 00:00:00 2001 From: SJost Date: Wed, 13 Dec 2017 16:02:10 +0100 Subject: [PATCH] Forgotten minor bugfixes that belong to master, but slipped into this branch. --- src/Foundation.hs | 4 ++-- src/Handler/Sheet.hs | 6 +++++- src/Handler/Submission.hs | 2 +- src/Handler/Utils/Submission.hs | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Foundation.hs b/src/Foundation.hs index fde407991..68a196b09 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -188,7 +188,7 @@ isAuthorizedDB (CourseEditExistR t c) _ = courseLecturerAccess . entityKey =<< g isAuthorizedDB (CourseEditExistIDR cID) _ = do courseId <- decrypt cID courseLecturerAccess courseId -isAuthorizedDB route isWrite = return $ Unauthorized "No access to this route." -- Calling isAuthorized here creates infinite loop! +isAuthorizedDB _route _isWrite = return $ Unauthorized "No access to this route." -- Calling isAuthorized here creates infinite loop! submissionAccess :: Either CryptoFileNameSubmission CryptoUUIDSubmission -> YesodDB UniWorX AuthResult submissionAccess cID = do @@ -384,7 +384,7 @@ instance YesodAuth UniWorX where authHttpManager = getHttpManager ldapConfig :: UniWorX -> LDAPConfig -ldapConfig app@(appSettings -> settings) = LDAPConfig +ldapConfig _app@(appSettings -> settings) = LDAPConfig { usernameFilter = \u -> principalName <> "=" <> u , identifierModifier , ldapUri = appLDAPURI settings diff --git a/src/Handler/Sheet.hs b/src/Handler/Sheet.hs index a3f3afa4d..63cdb036f 100644 --- a/src/Handler/Sheet.hs +++ b/src/Handler/Sheet.hs @@ -28,7 +28,11 @@ import Handler.Utils getSheetListR :: TermIdentifier -> Text -> Handler Html -getSheetListR _ _ = defaultLayout [whamlet| Under Construction !!! |] -- TODO +getSheetListR tid csh = do +-- mbAid <- maybeAuthId +-- _ <- runDB $ do +-- courseEnt@(Entity cid course) <- getBy404 $ CourseTermShort (TermKey tid) csh + defaultLayout [whamlet| Under Construction !!! |] -- TODO getSheetNewR :: TermIdentifier -> Text -> Handler Html getSheetNewR _ _ = defaultLayout [whamlet| Under Construction !!! |] -- TODO diff --git a/src/Handler/Submission.hs b/src/Handler/Submission.hs index ee5b54e5e..c46cc5727 100644 --- a/src/Handler/Submission.hs +++ b/src/Handler/Submission.hs @@ -100,7 +100,7 @@ postSubmissionListR = do sinks <- execStateC Map.empty . awaitForever $ \case v@(Right (sId, _)) -> lift $ feed sId v (Left f@File{..}) -> case splitDirectories fileTitle of - (cID:rest) + (cID:rest) | not (null rest) -> do sId <- decrypt (CryptoID $ CI.mk cID :: CryptoFileNameSubmission) lift . feed sId $ Left f{ fileTitle = joinPath rest } diff --git a/src/Handler/Utils/Submission.hs b/src/Handler/Utils/Submission.hs index 2713994ba..fad44f370 100644 --- a/src/Handler/Utils/Submission.hs +++ b/src/Handler/Utils/Submission.hs @@ -109,7 +109,7 @@ sinkSubmission sheetId userId mExists = do | not (null collidingFiles) = any (/~ file) [ f | (Entity _ f, _) <- collidingFiles ] | otherwise = True matchesUnderlying - | not (null underlyingFiles) = all (~~ file) [ f | (Entity _ f, Entity _ sf) <- underlyingFiles ] + | not (null underlyingFiles) = all (~~ file) [ f | (Entity _ f, Entity _ _sf) <- underlyingFiles ] | otherwise = False undoneDeletion = any submissionFileIsDeletion [ sf | (_, Entity _ sf) <- collidingFiles ]