mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 13:59:25 +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();
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
{{> adminNavItem content='Tests' icon='book-open' to='tests' current=current }}
|
||||
{{#eq userType 'account'}}
|
||||
{{> adminNavItem content='Test Templates' icon='trowel-bricks' to='test-templates' current=current }}
|
||||
{{/eq}}
|
||||
{{> adminNavItem content='Reports' icon='chart-column' to='reports' current=current }}
|
||||
{{/eq}}
|
||||
</div>
|
||||
<div class='adminNav__profile'>
|
||||
<div class='details'>
|
||||
|
||||
Reference in New Issue
Block a user