Fix Flowise 849 SSO And Role (#6634)

fix(flowise-849): sso and role
This commit is contained in:
yau-wd
2026-07-22 12:04:20 +08:00
committed by GitHub
parent ed9e100fb7
commit 9d3059fdc0
2 changed files with 7 additions and 0 deletions
@@ -162,6 +162,11 @@ export class LoginMethodController {
public async testConfig(req: Request, res: Response, next: NextFunction) {
let queryRunner
try {
this.assertEnterprisePlatform()
const user = getLoggedInUser(req)
assertQueryOrganizationMatchesActiveOrg(user, req.body.organizationId)
const providers = req.body.providers as { config: Record<string, unknown> }[]
const providerName = req.body.providerName as string
const organizationId = req.body.organizationId as string | undefined
@@ -122,6 +122,8 @@ export class RoleService {
const oldRole = await this.readRoleById(newRole.id, queryRunner)
if (!oldRole) throw new InternalFlowiseError(StatusCodes.NOT_FOUND, RoleErrorMessage.ROLE_NOT_FOUND)
if (newRole.organizationId !== oldRole.organizationId)
throw new InternalFlowiseError(StatusCodes.NOT_FOUND, RoleErrorMessage.ROLE_NOT_FOUND)
const user = await this.userService.readUserById(newRole.updatedBy, queryRunner)
if (!user) throw new InternalFlowiseError(StatusCodes.NOT_FOUND, UserErrorMessage.USER_NOT_FOUND)
if (newRole.name) this.validateRoleName(newRole.name)