Commit 2bfa5412 by Arturo Montejo Ráez

Merge branch 'master' into develop

parents 3645dade 361e6807
......@@ -3,7 +3,7 @@ module.exports = function isSupervisorOfStudentOrIsSupAdminOrIsStudent (req, res
// sails.log("TOKEN: " + JSON.stringify(req.token));
if (!req.params.id_stu)
return res.json(401, {error: 'Access denied 1'}); // If it is a student, then is ok
return res.json(401, {error: 'Access denied 1'});
Student.findOne(req.params.id_stu)
.then(function (s) {
......@@ -13,7 +13,7 @@ module.exports = function isSupervisorOfStudentOrIsSupAdminOrIsStudent (req, res
if (req.token.office && s.office == req.token.office.id && req.token.isSupAdmin)
return next(); // Is Office's administrator
s.supervisors((err, sups) => {
Student.supervisors(req.params.id_stu, function(err, sups) {
if (err || !sups || sups.length == 0)
return res.json(401, {error: "This student has no supervisors associated"});
......
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