BUGFIX: Authorization for Admins without schools fixed. cd /home/jost/programming/Haskell/Yesod/uniworx/src
This commit is contained in:
parent
05dcad6fa6
commit
5886b99bfc
@ -207,7 +207,7 @@ adminAccess :: Maybe (Maybe SchoolId) -- ^ If @Just@, matched exactly against 'u
|
|||||||
adminAccess school = do
|
adminAccess school = do
|
||||||
authId <- lift requireAuthId
|
authId <- lift requireAuthId
|
||||||
schools <- map (userAdminSchool . entityVal) <$> selectList [UserAdminUser ==. authId] []
|
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
|
True -> Authorized
|
||||||
False -> Unauthorized "No admin access"
|
False -> Unauthorized "No admin access"
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ lecturerAccess :: Maybe SchoolId
|
|||||||
lecturerAccess school = do
|
lecturerAccess school = do
|
||||||
authId <- lift requireAuthId
|
authId <- lift requireAuthId
|
||||||
schools <- map (userLecturerSchool . entityVal) <$> selectList [UserLecturerUser ==. authId] []
|
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
|
True -> Authorized
|
||||||
False -> Unauthorized "No lecturer access"
|
False -> Unauthorized "No lecturer access"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user