mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 20:59:30 +00:00
Lock down reports page to teachers only
This commit is contained in:
@@ -7,6 +7,13 @@ const User = require('../lib/User');
|
||||
|
||||
const validator = require('../lib/validator');
|
||||
|
||||
router.all(/\/reports.*/, (req, res, next) => {
|
||||
if (!req.session.userType === 'account')
|
||||
return res.redirect('/admin');
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
router.get('/reports', async (req, res) => {
|
||||
const u = await new User(req.db, req.session.userId);
|
||||
const classes = await u.getClasses();
|
||||
|
||||
Reference in New Issue
Block a user