solving problem with picto expressions (issue #478)

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