aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-15 10:49:46 +0200
committerChocobozzz <me@florianbigard.com>2019-04-15 14:39:52 +0200
commit1eddc9a74f9a80fa5d0cb25fceb3fc47a1a3c14a (patch)
tree91a10310cdf924779527525d39f8eb7e09e4ba49 /server/middlewares/validators
parent31b48aad478506d4214586f02792816efa968e4b (diff)
downloadPeerTube-1eddc9a74f9a80fa5d0cb25fceb3fc47a1a3c14a.tar.gz
PeerTube-1eddc9a74f9a80fa5d0cb25fceb3fc47a1a3c14a.tar.zst
PeerTube-1eddc9a74f9a80fa5d0cb25fceb3fc47a1a3c14a.zip
Add user adminFlags
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r--server/middlewares/validators/users.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts
index eceded1c4..6d8cd7894 100644
--- a/server/middlewares/validators/users.ts
+++ b/server/middlewares/validators/users.ts
@@ -5,6 +5,7 @@ import { body, param } from 'express-validator/check'
5import { omit } from 'lodash' 5import { omit } from 'lodash'
6import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' 6import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
7import { 7import {
8 isUserAdminFlagsValid,
8 isUserAutoPlayVideoValid, 9 isUserAutoPlayVideoValid,
9 isUserBlockedReasonValid, 10 isUserBlockedReasonValid,
10 isUserDescriptionValid, 11 isUserDescriptionValid,
@@ -32,6 +33,7 @@ const usersAddValidator = [
32 body('videoQuota').custom(isUserVideoQuotaValid).withMessage('Should have a valid user quota'), 33 body('videoQuota').custom(isUserVideoQuotaValid).withMessage('Should have a valid user quota'),
33 body('videoQuotaDaily').custom(isUserVideoQuotaDailyValid).withMessage('Should have a valid daily user quota'), 34 body('videoQuotaDaily').custom(isUserVideoQuotaDailyValid).withMessage('Should have a valid daily user quota'),
34 body('role').custom(isUserRoleValid).withMessage('Should have a valid role'), 35 body('role').custom(isUserRoleValid).withMessage('Should have a valid role'),
36 body('adminFlags').optional().custom(isUserAdminFlagsValid).withMessage('Should have a valid admin flags'),
35 37
36 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 38 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
37 logger.debug('Checking usersAdd parameters', { parameters: omit(req.body, 'password') }) 39 logger.debug('Checking usersAdd parameters', { parameters: omit(req.body, 'password') })
@@ -120,6 +122,7 @@ const usersUpdateValidator = [
120 body('videoQuota').optional().custom(isUserVideoQuotaValid).withMessage('Should have a valid user quota'), 122 body('videoQuota').optional().custom(isUserVideoQuotaValid).withMessage('Should have a valid user quota'),
121 body('videoQuotaDaily').optional().custom(isUserVideoQuotaDailyValid).withMessage('Should have a valid daily user quota'), 123 body('videoQuotaDaily').optional().custom(isUserVideoQuotaDailyValid).withMessage('Should have a valid daily user quota'),
122 body('role').optional().custom(isUserRoleValid).withMessage('Should have a valid role'), 124 body('role').optional().custom(isUserRoleValid).withMessage('Should have a valid role'),
125 body('adminFlags').optional().custom(isUserAdminFlagsValid).withMessage('Should have a valid admin flags'),
123 126
124 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 127 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
125 logger.debug('Checking usersUpdate parameters', { parameters: req.body }) 128 logger.debug('Checking usersUpdate parameters', { parameters: req.body })