From 5886b99bfc6370c045071e07c1747f4f90a42e93 Mon Sep 17 00:00:00 2001 From: SJost Date: Mon, 27 Nov 2017 16:17:51 +0100 Subject: [PATCH] BUGFIX: Authorization for Admins without schools fixed. cd /home/jost/programming/Haskell/Yesod/uniworx/src --- src/Foundation.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Foundation.hs b/src/Foundation.hs index dfed85e02..6d422c7e8 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -207,7 +207,7 @@ adminAccess :: Maybe (Maybe SchoolId) -- ^ If @Just@, matched exactly against 'u adminAccess school = do authId <- lift requireAuthId schools <- map (userAdminSchool . entityVal) <$> selectList [UserAdminUser ==. authId] [] - return $ case maybe (not $ null schools) (`elem` schools) school of + return $ case maybe (null schools) (`elem` schools) school of True -> Authorized False -> Unauthorized "No admin access" @@ -216,7 +216,7 @@ lecturerAccess :: Maybe SchoolId lecturerAccess school = do authId <- lift requireAuthId schools <- map (userLecturerSchool . entityVal) <$> selectList [UserLecturerUser ==. authId] [] - return $ case maybe (not $ null schools) (`elem` schools) school of + return $ case maybe (null schools) (`elem` schools) school of True -> Authorized False -> Unauthorized "No lecturer access"