From 8d8a037e3fe9b1d2ccbc4169ce59b13000b59cb0 Mon Sep 17 00:00:00 2001 From: Jelle Besseling Date: Tue, 12 Oct 2021 13:33:44 +0200 Subject: Allow configuration to be static/readonly (#4315) * Allow configuration to be static/readonly * Make all components disableable * Improve disabled component styling * Rename edits allowed field in configuration * Fix CI --- server/controllers/api/config.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'server/controllers/api') diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index d542f62aa..5ea1f67c9 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts @@ -11,7 +11,7 @@ import { objectConverter } from '../../helpers/core-utils' import { CONFIG, reloadConfig } from '../../initializers/config' import { ClientHtml } from '../../lib/client-html' import { asyncMiddleware, authenticate, ensureUserHasRight, openapiOperationDoc } from '../../middlewares' -import { customConfigUpdateValidator } from '../../middlewares/validators/config' +import { customConfigUpdateValidator, ensureConfigIsEditable } from '../../middlewares/validators/config' const configRouter = express.Router() @@ -38,6 +38,7 @@ configRouter.put('/custom', openapiOperationDoc({ operationId: 'putCustomConfig' }), authenticate, ensureUserHasRight(UserRight.MANAGE_CONFIGURATION), + ensureConfigIsEditable, customConfigUpdateValidator, asyncMiddleware(updateCustomConfig) ) @@ -46,6 +47,7 @@ configRouter.delete('/custom', openapiOperationDoc({ operationId: 'delCustomConfig' }), authenticate, ensureUserHasRight(UserRight.MANAGE_CONFIGURATION), + ensureConfigIsEditable, asyncMiddleware(deleteCustomConfig) ) -- cgit v1.2.3