Archived
UserCampusScope relation and audit action; scopeEvent/scopeList/unscopedOnly/ campusIndependent/scopeBroadcast markers; tests/campusScopeRoutes.test.js (still failing: events, payments, registrations, scan locks, tickets left). Can't delete a campus that has scoped staff. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 lines
717 B
JavaScript
18 lines
717 B
JavaScript
const express = require('express');
|
|
const router = express.Router();
|
|
const {
|
|
getSections,
|
|
createSection,
|
|
deleteSection,
|
|
updateSection
|
|
} = require('../controllers/sectionController');
|
|
const { protect, admin, supervisor, staff } = require('../middleware/authMiddleware');
|
|
const { scopeEvent, scopeList } = require('../utils/campusScope');
|
|
|
|
router.get('/', protect, staff, scopeList, getSections);
|
|
router.post('/', protect, supervisor, scopeEvent({ from: req => req.body?.eventId, need: 'manage' }), createSection);
|
|
router.delete('/:id', protect, admin, deleteSection);
|
|
router.put('/:id', protect, supervisor, scopeEvent({ resolve: 'section', need: 'manage' }), updateSection);
|
|
|
|
module.exports = router;
|