fix(core): Allow owner and admin to edit nodes with credentials that haven't been shared with them explicitly (#9922)

This commit is contained in:
Danny Martini
2024-07-09 16:25:50 +02:00
committed by GitHub
parent adb83155ca
commit 0f495986f8
4 changed files with 38 additions and 22 deletions

View File

@@ -63,11 +63,10 @@ export class CredentialsService {
user: User,
options: {
listQueryOptions?: ListQuery.Options;
onlyOwn?: boolean;
includeScopes?: string;
} = {},
) {
const returnAll = user.hasGlobalScope('credential:list') && !options.onlyOwn;
const returnAll = user.hasGlobalScope('credential:list');
const isDefaultSelect = !options.listQueryOptions?.select;
let projectRelations: ProjectRelation[] | undefined = undefined;

View File

@@ -80,7 +80,10 @@ export class EnterpriseWorkflowService {
currentUser: User,
): Promise<void> {
workflow.usedCredentials = [];
const userCredentials = await this.credentialsService.getMany(currentUser, { onlyOwn: true });
const userCredentials = await this.credentialsService.getCredentialsAUserCanUseInAWorkflow(
currentUser,
{ workflowId: workflow.id },
);
const credentialIdsUsedByWorkflow = new Set<string>();
workflow.nodes.forEach((node) => {
if (!node.credentials) {