Guest User

Untitled

a guest
May 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. api.post('/salvarEvento', md_auth.ensureAuth, EventoController.saveEvento);
  2.  
  3. 'use strict'
  4.  
  5.  
  6. exports.isAdmin = function(req, res, next){
  7. if (req.user.role != 'ROLE_ADMIN') {
  8. return res.status(200).send({
  9. mensagem: 'Você não tem acesso a zona',
  10. });
  11. }
  12. next();
  13. };
  14.  
  15. api.post('/salvarEvento', md_auth.ensureAuth, EventoController.saveEvento);
  16.  
  17. api.post('/salvarEvento', [ md_auth.ensureAuth, md_admin.isAdmin ], EventoController.saveEvento);
  18.  
  19. 'use strict'
  20.  
  21.  
  22. exports.isAdmin = function(req, res, next){
  23. if (req.user.role != 'ROLE_ADMIN') {
  24. return res.status(200).send({
  25. mensagem: 'Você não tem acesso a zona',
  26. });
  27. }
  28. next();
  29. };
Add Comment
Please, Sign In to add comment