/
githubmirror
/
novu
Обзор
Документация
Войти
/
githubmirror
/
novu
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
next
apps/api/src/app/integrations/utils/assert-integration-environment-scope.ts
24 строки
804 B
Himanshu Garg
fix(api-service): handle empty userEnvironmentId in delete environment and update integration fixes NV-8337 (#12013)
20 июл 2026, 20:39
Не верифицирован
20 июл 2026, 20:39
c6930cc
Код
Авторство
О чём код?
import { ForbiddenException } from '@nestjs/common'; type IntegrationMutationAction = 'update' | 'delete' | 'set as primary' | 'auto-configure'; export function assertIntegrationEnvironmentScope(params: { restrictToUserEnvironment?: boolean; userEnvironmentId?: string; integrationEnvironmentId: string; action: IntegrationMutationAction; }): void { if (!params.restrictToUserEnvironment) { return; } if (params.integrationEnvironmentId === params.userEnvironmentId) { return; } throw new ForbiddenException( `API key authentication is scoped to a single environment and cannot ${params.action} an integration ` + "that belongs to a different environment. Use an API key from the integration's environment, " + 'or authenticate with a session token.' ); }