mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-19 09:12:39 +00:00
feature: add suport for project scoped app connections
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { ProjectType } from "@app/db/schemas";
|
||||
import { OCIConnectionListItemSchema, SanitizedOCIConnectionSchema } from "@app/ee/services/app-connections/oci";
|
||||
import {
|
||||
OracleDBConnectionListItemSchema,
|
||||
SanitizedOracleDBConnectionSchema
|
||||
} from "@app/ee/services/app-connections/oracledb";
|
||||
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
|
||||
import { ApiDocsTags } from "@app/lib/api-docs";
|
||||
import { ApiDocsTags, AppConnections } from "@app/lib/api-docs";
|
||||
import { readLimit } from "@app/server/config/rateLimiter";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import {
|
||||
@@ -210,6 +211,9 @@ export const registerAppConnectionRouter = async (server: FastifyZodProvider) =>
|
||||
hide: false,
|
||||
tags: [ApiDocsTags.AppConnections],
|
||||
description: "List the available App Connection Options.",
|
||||
querystring: z.object({
|
||||
projectType: z.nativeEnum(ProjectType).optional()
|
||||
}),
|
||||
response: {
|
||||
200: z.object({
|
||||
appConnectionOptions: AppConnectionOptionsSchema.array()
|
||||
@@ -217,8 +221,8 @@ export const registerAppConnectionRouter = async (server: FastifyZodProvider) =>
|
||||
}
|
||||
},
|
||||
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
||||
handler: () => {
|
||||
const appConnectionOptions = server.services.appConnection.listAppConnectionOptions();
|
||||
handler: (req) => {
|
||||
const appConnectionOptions = server.services.appConnection.listAppConnectionOptions(req.query.projectType);
|
||||
return { appConnectionOptions };
|
||||
}
|
||||
});
|
||||
@@ -232,18 +236,27 @@ export const registerAppConnectionRouter = async (server: FastifyZodProvider) =>
|
||||
schema: {
|
||||
hide: false,
|
||||
tags: [ApiDocsTags.AppConnections],
|
||||
description: "List all the App Connections for the current organization.",
|
||||
description: "List all the App Connections for the current organization or project.",
|
||||
querystring: z.object({
|
||||
projectId: z.string().optional().describe(AppConnections.LIST().projectId)
|
||||
}),
|
||||
response: {
|
||||
200: z.object({ appConnections: SanitizedAppConnectionSchema.array() })
|
||||
}
|
||||
},
|
||||
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
||||
handler: async (req) => {
|
||||
const appConnections = await server.services.appConnection.listAppConnectionsByOrg(req.permission);
|
||||
const { projectId } = req.query;
|
||||
const appConnections = await server.services.appConnection.listAppConnections(
|
||||
req.permission,
|
||||
undefined,
|
||||
projectId
|
||||
);
|
||||
|
||||
await server.services.auditLog.createAuditLog({
|
||||
...req.auditLogInfo,
|
||||
orgId: req.permission.orgId,
|
||||
projectId,
|
||||
event: {
|
||||
type: EventType.GET_APP_CONNECTIONS,
|
||||
metadata: {
|
||||
|
||||
Reference in New Issue
Block a user