diff --git a/src/Foundation.hs b/src/Foundation.hs index ed1ba5598..f0f7b11d6 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -535,11 +535,7 @@ tagAccessPredicate AuthExamOffice = APDB $ \mAuthId route _ -> case route of return Authorized CourseR _ ssh _ _ -> $cachedHereBinary (mAuthId, ssh) . exceptT return return $ do authId <- maybeExceptT AuthenticationRequired $ return mAuthId - isExamOffice <- lift $ exists - [ UserFunctionUser ==. authId - , UserFunctionFunction ==. SchoolExamOffice - , UserFunctionSchool ==. ssh - ] + isExamOffice <- lift . existsBy $ UniqueUserFunction authId ssh SchoolExamOffice guardMExceptT isExamOffice $ unauthorizedI MsgUnauthorizedExamExamOffice return Authorized _other -> $cachedHereBinary mAuthId . exceptT return return $ do