File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,10 @@ export async function createOrganization(
7676 } ,
7777 attemptCount = 0
7878) : Promise < Organization & { projects : Project [ ] } > {
79+ if ( typeof process . env . BLOCKED_USERS === "string" && process . env . BLOCKED_USERS . includes ( userId ) ) {
80+ throw new Error ( "Organization could not be created." ) ;
81+ }
82+
7983 const uniqueOrgSlug = `${ slug ( title ) } -${ nanoid ( 4 ) } ` ;
8084
8185 const orgWithSameSlug = await prisma . organization . findFirst ( {
Original file line number Diff line number Diff line change @@ -153,6 +153,29 @@ export class PerformRunExecutionV2Service {
153153 return ;
154154 }
155155
156+ try {
157+ if (
158+ typeof process . env . BLOCKED_ORGS === "string" &&
159+ process . env . BLOCKED_ORGS . includes ( run . organizationId )
160+ ) {
161+ logger . debug ( "Skipping execution for blocked org" , {
162+ orgId : run . organizationId ,
163+ } ) ;
164+
165+ await this . #prismaClient. jobRun . update ( {
166+ where : {
167+ id : run . id ,
168+ } ,
169+ data : {
170+ status : "CANCELED" ,
171+ completedAt : new Date ( ) ,
172+ } ,
173+ } ) ;
174+
175+ return ;
176+ }
177+ } catch ( e ) { }
178+
156179 const client = new EndpointApi ( run . environment . apiKey , run . endpoint . url ) ;
157180 const event = eventRecordToApiJson ( run . event ) ;
158181
You can’t perform that action at this time.
0 commit comments