Skip to content

Commit 1b083fa

Browse files
committed
fix: listing events for admins
1 parent 6bc1a5f commit 1b083fa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

api/src/events/router.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export default router
1313

1414
router.get('', async (req, res, next) => {
1515
const sessionState = await session.reqAuthenticated(req)
16-
const { account, lang } = sessionState
16+
const { account, lang, accountRole } = sessionState
17+
if (accountRole !== 'admin') throw httpError(403, 'admin only')
1718

1819
const query: Filter<FullEvent> = { 'sender.type': account.type, 'sender.id': account.id }
1920
if (req.query.q && typeof req.query.q === 'string') query.$text = { $search: req.query.q, $language: lang || config.i18n.defaultLocale }

0 commit comments

Comments
 (0)