fix: When editing nodes only show the credentials in the dropdown that the user is allowed to use in that workflow (#9718)

This commit is contained in:
Danny Martini
2024-06-14 14:48:49 +02:00
committed by GitHub
parent 2dad9ce44c
commit 2cf4364ee0
16 changed files with 682 additions and 22 deletions

View File

@@ -52,6 +52,14 @@ export class CredentialsController {
});
}
@Get('/for-workflow')
async getProjectCredentials(req: CredentialRequest.ForWorkflow) {
const options = z
.union([z.object({ workflowId: z.string() }), z.object({ projectId: z.string() })])
.parse(req.query);
return await this.credentialsService.getCredentialsAUserCanUseInAWorkflow(req.user, options);
}
@Get('/new')
async generateUniqueName(req: CredentialRequest.NewName) {
const requestedName = req.query.name ?? config.getEnv('credentials.defaultName');