working on issue #581

parent 13f9c9bf
...@@ -75,9 +75,6 @@ module.exports = { ...@@ -75,9 +75,6 @@ module.exports = {
var stuSup = StuSup.findOne({id_sup: supervisor.id}) var stuSup = StuSup.findOne({id_sup: supervisor.id})
.then(function (stuSup) { .then(function (stuSup) {
if (!stuSup)
throw new Error("User without students linked to");
return stuSup; return stuSup;
}); });
...@@ -90,9 +87,13 @@ module.exports = { ...@@ -90,9 +87,13 @@ module.exports = {
}).spread(function(office, stuSup, supervisor) { }).spread(function(office, stuSup, supervisor) {
supervisor.office = office; if (office) {
if (office) supervisor.office = office;
supervisor.isSupAdmin = (office.admin === supervisor.id); supervisor.isSupAdmin = (office.admin === supervisor.id);
}
if (!supervisor.isSupAdmin && !stuSup)
throw new Error("User without students linked to");
return res.ok({ return res.ok({
user: supervisor, user: supervisor,
......
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