solving problem with picto expressions (issue #478)

parent e4c687a3
......@@ -89,8 +89,8 @@ module.exports = {
.populate('tags', {lang: student.lang})
.then((picto) => {
// check picto has expressions associated in student language
if (picto.expressions.length == 0 || picto.expressions[0].text.length == 0)
// check picto has expressions associated manually or associated in student language
if (!picto.attributes.expression & (picto.expressions.length == 0 || picto.expressions[0].text.length == 0))
stuPicto.attributes.expression = sails.__({
phrase: 'undef_label',
locale: student.lang});
......
......@@ -3,8 +3,8 @@ module.exports = function isAdmin (req, res, next) {
//
// Only if the user that has connected is global administrator (Yotta employee)
//
if (!req.token || req.token.role !== 'admin')
res.json(401, {error: 'Access denied'});
if (!req.token || !req.token.isAdmin)
res.json(401, {error: 'Access denied. You\'re not admin!'});
// Finally, if the user has a clean record, we'll call the `next()` function
// to let them through to the next policy or our controller
......
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