diff --git a/User/Routes/user.protected.routes.js b/User/Routes/user.protected.routes.js index b0897f9..f55d706 100644 --- a/User/Routes/user.protected.routes.js +++ b/User/Routes/user.protected.routes.js @@ -13,7 +13,7 @@ Router.get('/', getAllUsers); Router.get('/logout', logout); /* - * Router.delete('/customer', validateCustomerAdmin(), deleteCustomerUser); + * Router.delete('/customer', validateIssuer(), deleteCustomerUser); * Router.get('/team', validatePermission('Team', 'view'), getTeam); * Router.get('/', getUserDetailsByEmail); * Router.post('/', validate(emailBodyValidation), getUserDetailsByEmail); diff --git a/Utils/Middlewares/permissions.middleware.js b/Utils/Middlewares/permissions.middleware.js index 1ac0b7b..e749769 100644 --- a/Utils/Middlewares/permissions.middleware.js +++ b/Utils/Middlewares/permissions.middleware.js @@ -24,9 +24,9 @@ const validateSuperAdmin = () => (req, res, next) => { return getError(e, res); } }; -const validateCustomerAdmin = () => (req, res, next) => { +const validateIssuer = () => (req, res, next) => { try { - if (!req.user.customerAdmin) return res.status(401).json({ error: errorContstants.UNAUTHORIZED }); + if (!req.user.type=='issuer') return res.status(401).json({ error: errorContstants.UNAUTHORIZED }); return next(); } catch (e) { return getError(e, res); @@ -50,4 +50,4 @@ const validateUserProject = () => async (req, res, next) => { } }; -export { validateCustomerAdmin, validatePermission, validateSuperAdmin, validateUserProject }; +export { validateIssuer, validatePermission, validateSuperAdmin, validateUserProject };