GET /office/get/:id/supervisors working

parent e9ada63d
......@@ -144,15 +144,16 @@ module.exports = {
.populate('student')
.then((stusups) => {
var sup_obj = sup.toObject();
sup_obj.students = stusups.map((stusup) => {return stusup.student});
sup_obj.students = stusups.map((stusup) => {return stusup.student;});
sups.push(sup_obj);
next();
})
.catch((err) => next(err));
},
function(err) {
if (err)
return res.serverError("Unable to get students");
return res.ok(sups);
return res.ok(sups);
});
})
.catch(function () {
......
......@@ -3,7 +3,7 @@ module.exports = function isAdmin (req, res, next) {
//
// Only if the user that has connected is global administrator (Yotta employee)
//
if (!req.token || !(req.token.isAdmin || req.token.isSupAdmin))
if (!req.token || !req.token.isAdmin && !req.token.isSupAdmin)
res.json(401, {error: 'Access denied'});
// Finally, if the user has a clean record, we'll call the `next()` function
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment