working ish website
This commit is contained in:
parent
5540ac6d81
commit
b194d2031d
8 changed files with 271 additions and 6 deletions
|
|
@ -3,6 +3,7 @@
|
|||
let express = require('express');
|
||||
let router = express.Router();
|
||||
let passport = require('passport');
|
||||
let directory = require('../directory.js');
|
||||
let database = require('../config/database.js');
|
||||
let uuid = require('uuid');
|
||||
|
||||
|
|
@ -24,6 +25,9 @@ router.get('/student/:upn/pairing-code', function (req, res) {
|
|||
if(!req.isAuthenticated()) {
|
||||
return res.status(401).send('Unauthorized');
|
||||
}
|
||||
if (req.user.userType !== directory.USER_TYPE.STUDENT) {
|
||||
return res.status(403).send('Forbidden, not a student');
|
||||
}
|
||||
let upn = req.params.upn;
|
||||
// Is the logged in user a student with the same UPN as the one in the URL?
|
||||
// If not, return a 403 Forbidden response
|
||||
|
|
@ -45,6 +49,9 @@ router.get('/student/:upn', function (req, res) {
|
|||
if(!req.isAuthenticated()) {
|
||||
return res.status(401).send('Unauthorized');
|
||||
}
|
||||
if (req.user.userType !== directory.USER_TYPE.STUDENT) {
|
||||
return res.status(403).send('Forbidden, not a student');
|
||||
}
|
||||
let upn = req.params.upn;
|
||||
// Is the logged in user a student with the same UPN as the one in the URL?
|
||||
// If not, return a 403 Forbidden response
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue