@@ -14,8 +14,16 @@ import GoogleSSO from '../sso/GoogleSSO'
1414import { decrypt } from '../utils/encryption.util'
1515
1616export class LoginMethodController {
17+ private assertEnterprisePlatform ( ) : void {
18+ const platformType = getRunningExpressApp ( ) . identityManager . getPlatformType ( )
19+ if ( platformType === Platform . CLOUD || platformType === Platform . OPEN_SOURCE ) {
20+ throw new InternalFlowiseError ( StatusCodes . FORBIDDEN , GeneralErrorMessage . FORBIDDEN )
21+ }
22+ }
23+
1724 public async create ( req : Request , res : Response , next : NextFunction ) {
1825 try {
26+ this . assertEnterprisePlatform ( )
1927 const loginMethodService = new LoginMethodService ( )
2028 const loginMethod = await loginMethodService . createLoginMethod ( req . body )
2129 return res . status ( StatusCodes . CREATED ) . json ( loginMethod )
@@ -64,6 +72,7 @@ export class LoginMethodController {
6472 public async read ( req : Request , res : Response , next : NextFunction ) {
6573 let queryRunner
6674 try {
75+ this . assertEnterprisePlatform ( )
6776 queryRunner = getRunningExpressApp ( ) . AppDataSource . createQueryRunner ( )
6877 await queryRunner . connect ( )
6978 const query = req . query as Partial < LoginMethod >
@@ -102,6 +111,7 @@ export class LoginMethodController {
102111 }
103112 public async update ( req : Request , res : Response , next : NextFunction ) {
104113 try {
114+ this . assertEnterprisePlatform ( )
105115 const loginMethodService = new LoginMethodService ( )
106116 const loginMethod = await loginMethodService . createOrUpdateConfig ( req . body )
107117 if ( loginMethod ?. status === 'OK' && loginMethod ?. organizationId ) {
0 commit comments