BUGFIX: Authorization for Admins without schools fixed. cd /home/jost/programming/Haskell/Yesod/uniworx/src

This commit is contained in:
SJost 2017-11-27 16:17:51 +01:00
parent 05dcad6fa6
commit 5886b99bfc

View File

@ -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"