-
Why we are using 2 restrictTo functions in admin controller? router.use(authController.restrictTo('ADMIN', 'SUPER_ADMIN'));
router
.route('/user/:id')
.get(userController.getUser)
.patch(userController.updateUser)
.delete(userController.deleteUser);
router.get('/users', userController.getAllUsers);
router.put(
'/authorize-or-restrict/:userId',
restrictTo(Actions.UPDATE_USER),
authorizeOrRestrict
); |
Beta Was this translation helpful? Give feedback.
Answered by
muttaqin1
Jul 16, 2023
Replies: 3 comments 6 replies
-
Let me see, |
Beta Was this translation helpful? Give feedback.
6 replies
-
Can you do the task? This is a small task, It wont take more than five minutes. Just remove the function call. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, Thats correct we have to validate the roles or every authority.
The logic to validate every authority is already implemented.
so we can do this:
We will validate User role by the Role and all the upper level roles like Admin, superAdmin will be validated by authorities.
Now just we have to remove the authController restrictTo middleware.
By doing this we can achieve a great admin management.
@bellaabdelouahab