From a95a4cc89155f448e6f9ca0957170f3c72a9d964 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 30 Jul 2019 09:59:19 +0200 Subject: Moderators can only manage users --- server/controllers/api/users/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'server/controllers/api/users/index.ts') diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index 63747a0a9..ae40e86f8 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts @@ -31,7 +31,8 @@ import { usersAskSendVerifyEmailValidator, usersBlockingValidator, usersResetPasswordValidator, - usersVerifyEmailValidator + usersVerifyEmailValidator, + ensureCanManageUser } from '../../../middlewares/validators' import { UserModel } from '../../../models/account/user' import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '../../../helpers/audit-logger' @@ -97,12 +98,14 @@ usersRouter.post('/:id/block', authenticate, ensureUserHasRight(UserRight.MANAGE_USERS), asyncMiddleware(usersBlockingValidator), + ensureCanManageUser, asyncMiddleware(blockUser) ) usersRouter.post('/:id/unblock', authenticate, ensureUserHasRight(UserRight.MANAGE_USERS), asyncMiddleware(usersBlockingValidator), + ensureCanManageUser, asyncMiddleware(unblockUser) ) @@ -132,6 +135,7 @@ usersRouter.put('/:id', authenticate, ensureUserHasRight(UserRight.MANAGE_USERS), asyncMiddleware(usersUpdateValidator), + ensureCanManageUser, asyncMiddleware(updateUser) ) @@ -139,6 +143,7 @@ usersRouter.delete('/:id', authenticate, ensureUserHasRight(UserRight.MANAGE_USERS), asyncMiddleware(usersRemoveValidator), + ensureCanManageUser, asyncMiddleware(removeUser) ) -- cgit v1.2.3