Skip to content

Commit ce81827

Browse files
committed
feat: Update API routes to use preValidation instead of preHandler for global admin checks
1 parent 7ea7899 commit ce81827

File tree

13 files changed

+29
-11
lines changed

13 files changed

+29
-11
lines changed

services/backend/api-spec.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6155,6 +6155,17 @@
61556155
"Global Settings"
61566156
],
61576157
"description": "Tests GitHub App configuration by fetching Microsoft VS Code repository information. Only global administrators can access this endpoint.",
6158+
"requestBody": {
6159+
"content": {
6160+
"application/json": {
6161+
"schema": {
6162+
"type": "object",
6163+
"properties": {},
6164+
"additionalProperties": true
6165+
}
6166+
}
6167+
}
6168+
},
61586169
"security": [
61596170
{
61606171
"cookieAuth": []

services/backend/api-spec.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4287,6 +4287,13 @@ paths:
42874287
description: Tests GitHub App configuration by fetching Microsoft VS Code
42884288
repository information. Only global administrators can access this
42894289
endpoint.
4290+
requestBody:
4291+
content:
4292+
application/json:
4293+
schema:
4294+
type: object
4295+
properties: {}
4296+
additionalProperties: true
42904297
security:
42914298
- cookieAuth: []
42924299
responses:

services/backend/src/routes/globalSettings/categories/list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default async function listCategoriesRoute(fastify: FastifyInstance) {
4343
})
4444
}
4545
},
46-
preHandler: requireGlobalAdmin(),
46+
preValidation: requireGlobalAdmin(),
4747
}, async (request, reply) => {
4848
try {
4949
const categories = await GlobalSettingsService.getCategories();

services/backend/src/routes/globalSettings/github/test-connection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default async function githubTestConnectionRoute(fastify: FastifyInstance
6969
})
7070
}
7171
},
72-
preHandler: requireGlobalAdmin(),
72+
preValidation: requireGlobalAdmin(),
7373
}, async (request, reply) => {
7474
fastify.log.info({
7575
operation: 'github_app_test_connection',

services/backend/src/routes/globalSettings/groups/get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default async function getGroupSettingsRoute(fastify: FastifyInstance) {
5252
})
5353
}
5454
},
55-
preHandler: requireGlobalAdmin(),
55+
preValidation: requireGlobalAdmin(),
5656
}, async (request, reply) => {
5757
try {
5858
const { groupId } = request.params;

services/backend/src/routes/globalSettings/groups/list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default async function listGroupsRoute(fastify: FastifyInstance) {
4444
})
4545
}
4646
},
47-
preHandler: requireGlobalAdmin(),
47+
preValidation: requireGlobalAdmin(),
4848
}, async (request: FastifyRequest, reply: FastifyReply) => {
4949
try {
5050
const groupsWithSettings = await GlobalSettingsService.getAllGroupsWithSettings();

services/backend/src/routes/globalSettings/health/check.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default async function healthCheckRoute(fastify: FastifyInstance) {
4747
})
4848
}
4949
},
50-
preHandler: requireGlobalAdmin(),
50+
preValidation: requireGlobalAdmin(),
5151
}, async (request, reply) => {
5252
try {
5353
const encryptionWorking = validateEncryption();

services/backend/src/routes/globalSettings/settings/bulk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default async function bulkGlobalSettingsRoute(fastify: FastifyInstance)
6868
})
6969
}
7070
},
71-
preHandler: requireGlobalAdmin(),
71+
preValidation: requireGlobalAdmin(),
7272
}, async (request, reply) => {
7373
try {
7474
// Fastify has already validated request.body using BulkGlobalSettingsSchema

services/backend/src/routes/globalSettings/settings/delete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default async function deleteGlobalSettingRoute(fastify: FastifyInstance)
5555
})
5656
}
5757
},
58-
preHandler: requireGlobalAdmin(),
58+
preValidation: requireGlobalAdmin(),
5959
}, async (request, reply) => {
6060
try {
6161
const { key } = request.params;

services/backend/src/routes/globalSettings/settings/get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default async function getGlobalSettingRoute(fastify: FastifyInstance) {
5757
})
5858
}
5959
},
60-
preHandler: requireGlobalAdmin(),
60+
preValidation: requireGlobalAdmin(),
6161
}, async (request, reply) => {
6262
try {
6363
const { key } = request.params;

0 commit comments

Comments
 (0)