Commit 2a897a5d authored by pdg16's avatar pdg16
Browse files

separate admins authority in update users

parent 8481e7bf
Pipeline #19975 failed with stage
in 1 minute and 49 seconds
......@@ -292,7 +292,7 @@ userApp.put('/:id', passport.authenticate('bearer', { session: false }), checkAd
return next({err});
}
if(!user) {
if(!user || user.origin != req.user.origin) {
res.statusCode = 404;
return next({err: {
message: 'Usuário não encontrado'
......@@ -318,6 +318,11 @@ userApp.put('/:id', passport.authenticate('bearer', { session: false }), checkAd
user.receiveEmails = req.body.receiveEmails || user.receiveEmails;
user.citesegment = req.body.citesegment || user.citesegment;
user.citerole = req.body.citerole || user.citerole;
if(req.user.adminLDE)
user.adminLDE = req.body.adminLDE;
if(req.user.adminSimcaqNode)
user.adminSimcaqNode = req.body.adminSimcaqNode;
// console.log(user.checkPassword(req.body.password));
if ((req.body.password) && (req.body.newpassword)) {
......
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 to comment