no message

This commit is contained in:
2018-03-09 01:45:07 -05:00
parent c1e0e0aefd
commit b5dbff0b33
9 changed files with 18 additions and 18 deletions

View File

@@ -38,13 +38,13 @@ function processQueryParams (params) {
}
function update (req, res, next) {
// Token.verifyThen(req.get('authorization'), 'update', (err, decoded) => {
// if (err || (decoded && !decoded.hasPermission)) {
// res.status(403).json({ message: 'User not authorized to perform this action.', err: err });
// return;
// }
//
// if (decoded && decoded.hasPermission) {
Token.verifyThen(req.get('authorization'), 'update', (err, decoded) => {
if (err || (decoded && !decoded.hasPermission)) {
res.status(403).json({ message: 'User not authorized to perform this action.', err: err });
return;
}
if (decoded && decoded.hasPermission) {
var ProfileEvents = new EventEmitter();
var id = req.params.id;
var data = req.body;
@@ -65,8 +65,8 @@ function update (req, res, next) {
});
Profiles.update(ProfileEvents, id, data);
// }
// });
}
});
}
function updateMessage (req, res, next) {
@@ -327,13 +327,13 @@ Router.route('/:id?')
})
.patch( update )
.post((req, res) => {
Token.verifyThen(req.get('authorization'), 'add', (err, decoded) => {
if (err || (decoded && !decoded.hasPermission)) {
res.status(403).json({ message: 'User not authorized to perform this action.', err: err });
return;
}
if (decoded && decoded.hasPermission) {
// Token.verifyThen(req.get('authorization'), 'add', (err, decoded) => {
// if (err || (decoded && !decoded.hasPermission)) {
// res.status(403).json({ message: 'User not authorized to perform this action.', err: err });
// return;
// }
//
// if (decoded && decoded.hasPermission) {
var ProfileEvents = new EventEmitter();
var profile = Array.isArray(req.body) ? req.body : [ req.body ];
var multi = profile.length > 1;
@@ -349,8 +349,8 @@ Router.route('/:id?')
});
Profiles.create(ProfileEvents, profile);
}
});
// }
// });
})
.put( update );