fix(course-news): fix permissions

This commit is contained in:
Gregor Kleen 2019-10-01 21:32:23 +02:00
parent 7f81cd3b11
commit 9e5fde9027
2 changed files with 5 additions and 5 deletions

View File

@ -1129,13 +1129,13 @@ tagAccessPredicate AuthAllocationRegistered = APDB $ \mAuthId route _ -> case ro
r -> $unsupportedAuthPredicate AuthAllocationRegistered r r -> $unsupportedAuthPredicate AuthAllocationRegistered r
tagAccessPredicate AuthParticipant = APDB $ \mAuthId route _ -> case route of tagAccessPredicate AuthParticipant = APDB $ \mAuthId route _ -> case route of
CNewsR tid ssh csh cID _ -> maybeT (unauthorizedI MsgUnauthorizedCourseNewsParticipant) $ do CNewsR tid ssh csh cID _ -> maybeT (unauthorizedI MsgUnauthorizedCourseNewsParticipant) $ do
uid <- hoistMaybe mAuthId
nId <- catchIfMaybeT (const True :: CryptoIDError -> Bool) $ decrypt cID nId <- catchIfMaybeT (const True :: CryptoIDError -> Bool) $ decrypt cID
CourseNews{courseNewsParticipantsOnly} <- $cachedHereBinary nId . MaybeT $ get nId CourseNews{courseNewsParticipantsOnly} <- $cachedHereBinary nId . MaybeT $ get nId
if | courseNewsParticipantsOnly if | courseNewsParticipantsOnly -> do
-> exceptT return (const mzero) . hoist lift $ isCourseParticipant tid ssh csh uid uid <- hoistMaybe mAuthId
exceptT return (const mzero) . hoist lift $ isCourseParticipant tid ssh csh uid
| otherwise | otherwise
-> return Authorized -> return Authorized
CourseR tid ssh csh (CUserR cID) -> exceptT return return $ do CourseR tid ssh csh (CUserR cID) -> exceptT return return $ do
participant <- catchIfMExceptT (const $ unauthorizedI MsgUnauthorizedParticipant) (const True :: CryptoIDError -> Bool) $ decrypt cID participant <- catchIfMExceptT (const $ unauthorizedI MsgUnauthorizedParticipant) (const True :: CryptoIDError -> Bool) $ decrypt cID

View File

@ -1,6 +1,6 @@
$newline never $newline never
<dl .deflist> <dl .deflist>
$if not (null news) || not visibleNews $if not (null news) || mayCreateNews
<dt .deflist__dt> <dt .deflist__dt>
_{MsgCourseNews} _{MsgCourseNews}
$if not visibleNews $if not visibleNews