Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/routes/faqRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ const checkFaqPermission = (requiredPermission) => (req, res, next) => {

// Define routes with verifyToken and checkFaqPermission
router.get('/faqs/search', verifyToken, faqController.searchFAQs);
router.get('/faqs', verifyToken, faqController.getAllFAQs);
// Public: the job listing page at /collaboration is reachable without signing in,
// and its FAQ section reads from here. getAllFAQs does not use req.user.
// Every other FAQ route below stays behind verifyToken.
router.get('/faqs', faqController.getAllFAQs);
router.post('/faqs', verifyToken, checkFaqPermission('manageFAQs'), faqController.createFAQ);
router.put('/faqs/:id', verifyToken, checkFaqPermission('manageFAQs'), faqController.updateFAQ);
router.delete('/faqs/:id', verifyToken, checkFaqPermission('manageFAQs'), faqController.deleteFAQ);
Expand Down
8 changes: 8 additions & 0 deletions src/startup/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ module.exports = function (app) {
return;
}

// Public FAQ list: the job listing page at /collaboration is reachable without
// signing in, and its FAQ section reads from here. Matched exactly so the
// search, history and unanswered FAQ routes stay behind authentication.
if (req.path === '/api/faqs' && req.method === 'GET') {
next();
return;
}

if (req.originalUrl.startsWith('/api/bluesky')) {
next();
return;
Expand Down
Loading