@@ -16,6 +16,12 @@ import { decrypt } from '../utils/encryption.util'
1616export class LoginMethodController {
1717 public async create ( req : Request , res : Response , next : NextFunction ) {
1818 try {
19+ if (
20+ getRunningExpressApp ( ) . identityManager . getPlatformType ( ) === Platform . CLOUD ||
21+ getRunningExpressApp ( ) . identityManager . getPlatformType ( ) === Platform . OPEN_SOURCE
22+ ) {
23+ throw new InternalFlowiseError ( StatusCodes . BAD_GATEWAY , GeneralErrorMessage . FORBIDDEN )
24+ }
1925 const loginMethodService = new LoginMethodService ( )
2026 const loginMethod = await loginMethodService . createLoginMethod ( req . body )
2127 return res . status ( StatusCodes . CREATED ) . json ( loginMethod )
@@ -66,8 +72,11 @@ export class LoginMethodController {
6672 try {
6773 queryRunner = getRunningExpressApp ( ) . AppDataSource . createQueryRunner ( )
6874 await queryRunner . connect ( )
69- if ( getRunningExpressApp ( ) . identityManager . getPlatformType ( ) === Platform . CLOUD ) {
70- throw new InternalFlowiseError ( StatusCodes . BAD_REQUEST , GeneralErrorMessage . FORBIDDEN )
75+ if (
76+ getRunningExpressApp ( ) . identityManager . getPlatformType ( ) === Platform . CLOUD ||
77+ getRunningExpressApp ( ) . identityManager . getPlatformType ( ) === Platform . OPEN_SOURCE
78+ ) {
79+ throw new InternalFlowiseError ( StatusCodes . FORBIDDEN , GeneralErrorMessage . FORBIDDEN )
7180 }
7281 const query = req . query as Partial < LoginMethod >
7382 const loginMethodService = new LoginMethodService ( )
@@ -106,8 +115,11 @@ export class LoginMethodController {
106115 public async update ( req : Request , res : Response , next : NextFunction ) {
107116 try {
108117 const loginMethodService = new LoginMethodService ( )
109- if ( getRunningExpressApp ( ) . identityManager . getPlatformType ( ) === Platform . CLOUD ) {
110- throw new InternalFlowiseError ( StatusCodes . BAD_REQUEST , GeneralErrorMessage . FORBIDDEN )
118+ if (
119+ getRunningExpressApp ( ) . identityManager . getPlatformType ( ) === Platform . CLOUD ||
120+ getRunningExpressApp ( ) . identityManager . getPlatformType ( ) === Platform . OPEN_SOURCE
121+ ) {
122+ throw new InternalFlowiseError ( StatusCodes . FORBIDDEN , GeneralErrorMessage . FORBIDDEN )
111123 }
112124 const loginMethod = await loginMethodService . createOrUpdateConfig ( req . body )
113125 if ( loginMethod ?. status === 'OK' && loginMethod ?. organizationId ) {
0 commit comments