Skip to content

Commit

Permalink
refractor
Browse files Browse the repository at this point in the history
  • Loading branch information
Saransh Balyan committed Aug 2, 2024
1 parent 9ae4f22 commit e09bcb4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion User/Routes/user.protected.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions Utils/Middlewares/permissions.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -50,4 +50,4 @@ const validateUserProject = () => async (req, res, next) => {
}
};

export { validateCustomerAdmin, validatePermission, validateSuperAdmin, validateUserProject };
export { validateIssuer, validatePermission, validateSuperAdmin, validateUserProject };

0 comments on commit e09bcb4

Please sign in to comment.