feat: Replace owner checks with scope checks (no-changelog) (#7846)
Github issue / Community forum post (link here to close automatically):
This commit is contained in:
@@ -273,10 +273,10 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
|
||||
filters: IGetExecutionsQueryFilter | undefined,
|
||||
accessibleWorkflowIds: string[],
|
||||
currentlyRunningExecutions: string[],
|
||||
isOwner: boolean,
|
||||
hasGlobalRead: boolean,
|
||||
): Promise<{ count: number; estimated: boolean }> {
|
||||
const dbType = config.getEnv('database.type');
|
||||
if (dbType !== 'postgresdb' || (filters && Object.keys(filters).length > 0) || !isOwner) {
|
||||
if (dbType !== 'postgresdb' || (filters && Object.keys(filters).length > 0) || !hasGlobalRead) {
|
||||
const query = this.createQueryBuilder('execution').andWhere(
|
||||
'execution.workflowId IN (:...accessibleWorkflowIds)',
|
||||
{ accessibleWorkflowIds },
|
||||
|
||||
@@ -15,7 +15,7 @@ export class SharedCredentialsRepository extends Repository<SharedCredentials> {
|
||||
relations: ['credentials'],
|
||||
where: {
|
||||
credentialsId,
|
||||
...(!user.isOwner ? { userId: user.id } : {}),
|
||||
...(!(await user.hasGlobalScope('credential:read')) ? { userId: user.id } : {}),
|
||||
},
|
||||
});
|
||||
if (!sharedCredential) return null;
|
||||
|
||||
Reference in New Issue
Block a user