refactor: hlint
This commit is contained in:
parent
55a9c8a5ae
commit
683a7da5fe
@ -382,7 +382,7 @@ data AuthorizationCacheKey
|
||||
cacheAPSchoolFunction :: BearerAuthSite UniWorX
|
||||
=> SchoolFunction
|
||||
-> Maybe Expiry
|
||||
-> (Maybe (AuthId UniWorX) -> Route UniWorX -> Bool -> Set (AuthId (UniWorX)) -> Either AccessPredicate (HandlerFor UniWorX AuthResult))
|
||||
-> (Maybe (AuthId UniWorX) -> Route UniWorX -> Bool -> Set (AuthId UniWorX) -> Either AccessPredicate (HandlerFor UniWorX AuthResult))
|
||||
-> AccessPredicate
|
||||
cacheAPSchoolFunction f mExp = cacheAP mExp (AuthCacheSchoolFunctionList f) mkFunctionList
|
||||
where
|
||||
@ -393,7 +393,7 @@ cacheAPSchoolFunction f mExp = cacheAP mExp (AuthCacheSchoolFunctionList f) mkFu
|
||||
cacheAPSystemFunction :: BearerAuthSite UniWorX
|
||||
=> SystemFunction
|
||||
-> Maybe Expiry
|
||||
-> (Maybe (AuthId UniWorX) -> Route UniWorX -> Bool -> Set (AuthId (UniWorX)) -> Either AccessPredicate (HandlerFor UniWorX AuthResult))
|
||||
-> (Maybe (AuthId UniWorX) -> Route UniWorX -> Bool -> Set (AuthId UniWorX) -> Either AccessPredicate (HandlerFor UniWorX AuthResult))
|
||||
-> AccessPredicate
|
||||
cacheAPSystemFunction f mExp = cacheAP mExp (AuthCacheSystemFunctionList f) mkFunctionList
|
||||
where
|
||||
@ -408,8 +408,8 @@ tagAccessPredicate AuthFree = trueAP
|
||||
tagAccessPredicate AuthAdmin = cacheAPSchoolFunction SchoolAdmin (Just $ Right diffHour) $ \mAuthId' route' _ adminList -> if
|
||||
| maybe True (`Set.notMember` adminList) mAuthId' -> Right $ case route' of
|
||||
_ | is _Nothing mAuthId' -> return AuthenticationRequired
|
||||
CourseR _ _ _ _ -> unauthorizedI MsgUnauthorizedSchoolAdmin
|
||||
AllocationR _ _ _ _ -> unauthorizedI MsgUnauthorizedSchoolAdmin
|
||||
CourseR{} -> unauthorizedI MsgUnauthorizedSchoolAdmin
|
||||
AllocationR{} -> unauthorizedI MsgUnauthorizedSchoolAdmin
|
||||
SchoolR _ _ -> unauthorizedI MsgUnauthorizedSchoolAdmin
|
||||
_other -> unauthorizedI MsgUnauthorizedSiteAdmin
|
||||
| otherwise -> Left $ APDB $ \_ _ mAuthId route _ -> case route of
|
||||
@ -470,9 +470,9 @@ tagAccessPredicate AuthStudent = cacheAPSystemFunction SystemStudent (Just $ Rig
|
||||
tagAccessPredicate AuthExamOffice = cacheAPSchoolFunction SchoolExamOffice (Just $ Right diffHour) $ \mAuthId' route' _ examOfficeList -> if
|
||||
| maybe True (`Set.notMember` examOfficeList) mAuthId' -> Right $ case route' of
|
||||
_ | is _Nothing mAuthId' -> return AuthenticationRequired
|
||||
CExamR _ _ _ _ _ -> unauthorizedI MsgUnauthorizedExamExamOffice
|
||||
EExamR _ _ _ _ _ -> unauthorizedI MsgUnauthorizedExternalExamExamOffice
|
||||
CourseR _ _ _ _ -> unauthorizedI MsgUnauthorizedExamExamOffice
|
||||
CExamR{} -> unauthorizedI MsgUnauthorizedExamExamOffice
|
||||
EExamR{} -> unauthorizedI MsgUnauthorizedExternalExamExamOffice
|
||||
CourseR{} -> unauthorizedI MsgUnauthorizedExamExamOffice
|
||||
SchoolR _ _ -> unauthorizedI MsgUnauthorizedSchoolExamOffice
|
||||
_other -> unauthorizedI MsgUnauthorizedExamOffice
|
||||
| otherwise -> Left $ APDB $ \_ _ mAuthId route _ -> case route of
|
||||
@ -586,9 +586,9 @@ tagAccessPredicate AuthLecturer = cacheAP' (Just $ Right diffMinute) mkLecturerL
|
||||
| Just lecturerList <- mLecturerList
|
||||
, maybe True (`Set.notMember` lecturerList) mAuthId' -> Right $ case route' of
|
||||
_ | is _Nothing mAuthId' -> return AuthenticationRequired
|
||||
CourseR _ _ _ _ -> unauthorizedI MsgUnauthorizedLecturer
|
||||
AllocationR _ _ _ _ -> unauthorizedI MsgUnauthorizedAllocationLecturer
|
||||
EExamR _ _ _ _ _ -> unauthorizedI MsgUnauthorizedExternalExamLecturer
|
||||
CourseR{} -> unauthorizedI MsgUnauthorizedLecturer
|
||||
AllocationR{} -> unauthorizedI MsgUnauthorizedAllocationLecturer
|
||||
EExamR{} -> unauthorizedI MsgUnauthorizedExternalExamLecturer
|
||||
_other -> unauthorizedI MsgUnauthorizedSchoolLecturer
|
||||
| otherwise -> Left $ APDB $ \_ _ mAuthId route _ -> case route of
|
||||
CourseR tid ssh csh _ -> $cachedHereBinary (mAuthId, tid, ssh, csh) . exceptT return return $ do
|
||||
@ -631,9 +631,9 @@ tagAccessPredicate AuthLecturer = cacheAP' (Just $ Right diffMinute) mkLecturerL
|
||||
return Authorized
|
||||
where
|
||||
mkLecturerList _ route _ = case route of
|
||||
CourseR _ _ _ _ -> cacheLecturerList
|
||||
AllocationR _ _ _ _ -> cacheLecturerList
|
||||
EExamR _ _ _ _ _ -> cacheLecturerList
|
||||
CourseR{} -> cacheLecturerList
|
||||
AllocationR{} -> cacheLecturerList
|
||||
EExamR{} -> cacheLecturerList
|
||||
_other -> Just
|
||||
( AuthCacheSchoolFunctionList SchoolLecturer
|
||||
, runDBRead . fmap (setOf $ folded . _Value) . E.select . E.from $ \userFunction -> do
|
||||
@ -648,9 +648,9 @@ tagAccessPredicate AuthLecturer = cacheAP' (Just $ Right diffMinute) mkLecturerL
|
||||
tagAccessPredicate AuthCorrector = cacheAP (Just $ Right diffMinute) AuthCacheCorrectorList mkCorrectorList $ \mAuthId' route' _ correctorList -> if
|
||||
| maybe False (`Set.notMember` correctorList) mAuthId' -> Right $ case route' of
|
||||
_ | is _Nothing mAuthId' -> return AuthenticationRequired
|
||||
CSubmissionR _ _ _ _ _ _ -> unauthorizedI MsgUnauthorizedSubmissionCorrector
|
||||
CSheetR _ _ _ _ _ -> unauthorizedI MsgUnauthorizedSheetCorrector
|
||||
CourseR _ _ _ _ -> unauthorizedI MsgUnauthorizedCorrector
|
||||
CSubmissionR{} -> unauthorizedI MsgUnauthorizedSubmissionCorrector
|
||||
CSheetR{} -> unauthorizedI MsgUnauthorizedSheetCorrector
|
||||
CourseR{} -> unauthorizedI MsgUnauthorizedCorrector
|
||||
_other -> unauthorizedI MsgUnauthorizedCorrectorAny
|
||||
| otherwise -> Left $ APDB $ \_ _ mAuthId route _ -> exceptT return return $ do
|
||||
authId <- maybeExceptT AuthenticationRequired $ return mAuthId
|
||||
@ -689,8 +689,8 @@ tagAccessPredicate AuthCorrector = cacheAP (Just $ Right diffMinute) AuthCacheCo
|
||||
tagAccessPredicate AuthExamCorrector = cacheAP (Just $ Right diffMinute) AuthCacheExamCorrectorList mkExamCorrectorList $ \mAuthId' route' _ examCorrectorList -> if
|
||||
| maybe False (`Set.notMember` examCorrectorList) mAuthId' -> Right $ case route' of
|
||||
_ | is _Nothing mAuthId' -> return AuthenticationRequired
|
||||
CExamR _ _ _ _ _ -> unauthorizedI MsgUnauthorizedExamCorrector
|
||||
CourseR _ _ _ _ -> unauthorizedI MsgUnauthorizedExamCorrector
|
||||
CExamR{} -> unauthorizedI MsgUnauthorizedExamCorrector
|
||||
CourseR{} -> unauthorizedI MsgUnauthorizedExamCorrector
|
||||
r -> $unsupportedAuthPredicate AuthExamCorrector r
|
||||
| otherwise -> Left $ APDB $ \_ _ mAuthId route _ -> case route of
|
||||
CExamR tid ssh csh examn _ -> $cachedHereBinary (mAuthId, tid, ssh, csh, examn) . exceptT return return $ do
|
||||
@ -722,8 +722,8 @@ tagAccessPredicate AuthExamCorrector = cacheAP (Just $ Right diffMinute) AuthCac
|
||||
tagAccessPredicate AuthTutor = cacheAP (Just $ Right diffMinute) AuthCacheTutorList mkTutorList $ \mAuthId' route' _ tutorList -> if
|
||||
| maybe False (`Set.notMember` tutorList) mAuthId' -> Right $ case route' of
|
||||
_ | is _Nothing mAuthId' -> return AuthenticationRequired
|
||||
CTutorialR _ _ _ _ _ -> unauthorizedI MsgUnauthorizedTutorialTutor
|
||||
CourseR _ _ _ _ -> unauthorizedI MsgUnauthorizedCourseTutor
|
||||
CTutorialR{} -> unauthorizedI MsgUnauthorizedTutorialTutor
|
||||
CourseR{} -> unauthorizedI MsgUnauthorizedCourseTutor
|
||||
_other -> unauthorizedI MsgUnauthorizedTutor
|
||||
| otherwise -> Left $ APDB $ \_ _ mAuthId route _ -> exceptT return return $ do
|
||||
authId <- maybeExceptT AuthenticationRequired $ return mAuthId
|
||||
@ -760,8 +760,8 @@ tagAccessPredicate AuthTutorControl = APDB $ \_ _ _ route _ -> case route of
|
||||
tagAccessPredicate AuthSubmissionGroup = cacheAP (Just $ Right diffMinute) AuthCacheSubmissionGroupUserList mkSubmissionGroupUserList $ \mAuthId' route' _ submissionGroupUserList -> if
|
||||
| maybe True (`Set.notMember` submissionGroupUserList) mAuthId' -> Right $ case route' of
|
||||
_ | is _Nothing mAuthId' -> return AuthenticationRequired
|
||||
CSubmissionR _ _ _ _ _ _ -> unauthorizedI MsgUnauthorizedSubmissionSubmissionGroup
|
||||
CSheetR _ _ _ _ _ -> unauthorizedI MsgUnauthorizedSheetSubmissionGroup
|
||||
CSubmissionR{} -> unauthorizedI MsgUnauthorizedSubmissionSubmissionGroup
|
||||
CSheetR{} -> unauthorizedI MsgUnauthorizedSheetSubmissionGroup
|
||||
r -> $unsupportedAuthPredicate AuthSubmissionGroup r
|
||||
| otherwise -> Left $ APDB $ \_ _ mAuthId route _ -> case route of
|
||||
CSubmissionR tid ssh csh shn cID _ -> maybeT (unauthorizedI MsgUnauthorizedSubmissionSubmissionGroup) $ do
|
||||
@ -1054,7 +1054,7 @@ tagAccessPredicate AuthCourseRegistered = cacheAP' (Just $ Right diffMinute) mkA
|
||||
| Just courseRegisteredList <- mCourseRegisteredList
|
||||
, maybe True (`Set.notMember` courseRegisteredList) mAuthId' -> Right $ case route' of
|
||||
_ | is _Nothing mAuthId' -> return AuthenticationRequired
|
||||
CourseR _ _ _ _ -> unauthorizedI MsgUnauthorizedRegistered
|
||||
CourseR{} -> unauthorizedI MsgUnauthorizedRegistered
|
||||
r -> $unsupportedAuthPredicate AuthCourseRegistered r
|
||||
| otherwise -> Left $ APDB $ \_ _ mAuthId route _ -> case route of
|
||||
CourseR tid ssh csh _ -> exceptT return return $ do
|
||||
|
||||
Loading…
Reference in New Issue
Block a user