@@ -15,6 +15,7 @@ import {
1515 UpsertAppConnectionRequestBody ,
1616} from '@openops/shared' ;
1717import { StatusCodes } from 'http-status-codes' ;
18+ import { getProjectScopedRoutePolicy } from '../core/security/route-policies/route-security-policy-factory' ;
1819import { sendConnectionDeletedEvent } from '../telemetry/event-models' ;
1920import { appConnectionService } from './app-connection-service/app-connection-service' ;
2021import { redactSecrets , removeSensitiveData } from './app-connection-utils' ;
@@ -155,7 +156,10 @@ const DEFAULT_PAGE_SIZE = 10;
155156const UpsertAppConnectionRequest = {
156157 config : {
157158 allowedPrincipals : [ PrincipalType . USER , PrincipalType . SERVICE ] ,
158- permission : Permission . WRITE_APP_CONNECTION ,
159+ security : getProjectScopedRoutePolicy ( {
160+ allowedPrincipals : [ PrincipalType . USER , PrincipalType . SERVICE ] ,
161+ permission : Permission . WRITE_APP_CONNECTION ,
162+ } ) ,
159163 } ,
160164 schema : {
161165 tags : [ 'app-connections' ] ,
@@ -172,7 +176,10 @@ const UpsertAppConnectionRequest = {
172176const PatchAppConnectionRequest = {
173177 config : {
174178 allowedPrincipals : [ PrincipalType . USER , PrincipalType . SERVICE ] ,
175- permission : Permission . WRITE_APP_CONNECTION ,
179+ security : getProjectScopedRoutePolicy ( {
180+ allowedPrincipals : [ PrincipalType . USER , PrincipalType . SERVICE ] ,
181+ permission : Permission . WRITE_APP_CONNECTION ,
182+ } ) ,
176183 } ,
177184 schema : {
178185 operationId : 'Update Connection' ,
@@ -190,7 +197,10 @@ const PatchAppConnectionRequest = {
190197const ListAppConnectionsRequest = {
191198 config : {
192199 allowedPrincipals : [ PrincipalType . USER , PrincipalType . SERVICE ] ,
193- permission : Permission . READ_APP_CONNECTION ,
200+ security : getProjectScopedRoutePolicy ( {
201+ allowedPrincipals : [ PrincipalType . USER , PrincipalType . SERVICE ] ,
202+ permission : Permission . READ_APP_CONNECTION ,
203+ } ) ,
194204 } ,
195205 schema : {
196206 operationId : 'List Connections' ,
@@ -208,7 +218,10 @@ const ListAppConnectionsRequest = {
208218const DeleteAppConnectionRequest = {
209219 config : {
210220 allowedPrincipals : [ PrincipalType . USER , PrincipalType . SERVICE ] ,
211- permission : Permission . WRITE_APP_CONNECTION ,
221+ security : getProjectScopedRoutePolicy ( {
222+ allowedPrincipals : [ PrincipalType . USER , PrincipalType . SERVICE ] ,
223+ permission : Permission . DELETE_APP_CONNECTION ,
224+ } ) ,
212225 } ,
213226 schema : {
214227 tags : [ 'app-connections' ] ,
@@ -227,7 +240,10 @@ const DeleteAppConnectionRequest = {
227240const GetAppConnectionRequest = {
228241 config : {
229242 allowedPrincipals : [ PrincipalType . USER , PrincipalType . SERVICE ] ,
230- permission : Permission . READ_APP_CONNECTION ,
243+ security : getProjectScopedRoutePolicy ( {
244+ allowedPrincipals : [ PrincipalType . USER , PrincipalType . SERVICE ] ,
245+ permission : Permission . READ_APP_CONNECTION ,
246+ } ) ,
231247 } ,
232248 schema : {
233249 operationId : 'Get Connection Details' ,
@@ -254,7 +270,10 @@ const GetAppConnectionRequest = {
254270const GetConnectionMetadataRequest = {
255271 config : {
256272 allowedPrincipals : [ PrincipalType . USER , PrincipalType . SERVICE ] ,
257- permission : Permission . READ_APP_CONNECTION ,
273+ security : getProjectScopedRoutePolicy ( {
274+ allowedPrincipals : [ PrincipalType . USER , PrincipalType . SERVICE ] ,
275+ permission : Permission . READ_APP_CONNECTION ,
276+ } ) ,
258277 } ,
259278 schema : {
260279 operationId : 'Get Connection Metadata' ,
0 commit comments