diff --git a/src/Foundation/Authorization.hs b/src/Foundation/Authorization.hs index 6c9a8369b..f3476fae4 100644 --- a/src/Foundation/Authorization.hs +++ b/src/Foundation/Authorization.hs @@ -401,7 +401,7 @@ data AuthorizationCacheKey | AuthCacheWorkflowInstanceInitiators WorkflowInstanceName RouteWorkflowScope | AuthCacheWorkflowInstanceWorkflowViewers WorkflowInstanceName RouteWorkflowScope | AuthCacheSchoolFunctionList SchoolFunction | AuthCacheSystemFunctionList SystemFunction - | AuthCacheLecturerList | AuthCacheCorrectorList | AuthCacheExamCorrectorList | AuthCacheTutorList | AuthCacheSubmissionGroupUserList + | AuthCacheLecturerList | AuthCacheExternalExamStaffList | AuthCacheCorrectorList | AuthCacheExamCorrectorList | AuthCacheTutorList | AuthCacheSubmissionGroupUserList | AuthCacheCourseRegisteredList TermId SchoolId CourseShorthand deriving (Eq, Ord, Read, Show, Generic, Typeable) deriving anyclass (Hashable, Binary) @@ -660,7 +660,10 @@ tagAccessPredicate AuthLecturer = cacheAP' (Just $ Right diffMinute) mkLecturerL mkLecturerList _ route _ = case route of CourseR{} -> cacheLecturerList AllocationR{} -> cacheLecturerList - EExamR{} -> cacheLecturerList + EExamR{} -> Just + ( AuthCacheExternalExamStaffList + , runDBRead . fmap (setOf $ folded . _Value) . E.select . E.from $ return . (E.^. ExternalExamStaffUser) + ) _other -> Just ( AuthCacheSchoolFunctionList SchoolLecturer , runDBRead . fmap (setOf $ folded . _Value) . E.select . E.from $ \userFunction -> do diff --git a/src/Handler/ExternalExam/Edit.hs b/src/Handler/ExternalExam/Edit.hs index 48f4d70a0..05fe04e08 100644 --- a/src/Handler/ExternalExam/Edit.hs +++ b/src/Handler/ExternalExam/Edit.hs @@ -55,6 +55,7 @@ postEEEditR tid ssh coursen examn = do when (is _Nothing replaceRes) $ do audit $ TransactionExternalExamEdit eeId + memcachedByInvalidate AuthCacheExternalExamStaffList $ Proxy @(Set UserId) forM_ (eefStaff `setSymmDiff` staff) $ \change -> if | change `Set.member` eefStaff -> case change of Left invEmail -> do diff --git a/src/Handler/ExternalExam/New.hs b/src/Handler/ExternalExam/New.hs index e4f7dffac..b6ab5599f 100644 --- a/src/Handler/ExternalExam/New.hs +++ b/src/Handler/ExternalExam/New.hs @@ -42,6 +42,7 @@ postEExamNewR = do forM_ eefOfficeSchools' $ \ExternalExamOfficeSchool{..} -> audit $ TransactionExternalExamOfficeSchoolEdit eeId externalExamOfficeSchoolSchool + memcachedByInvalidate AuthCacheExternalExamStaffList $ Proxy @(Set UserId) let (invites, adds) = partitionEithers $ Set.toList eefStaff eefStaff' = do externalExamStaffUser <- adds