Fix permissions
This commit is contained in:
@ -75,6 +75,7 @@ export class AbilityFactory {
|
||||
// CommentThread
|
||||
can(AbilityAction.Read, 'CommentThread', { workspaceId: workspace.id });
|
||||
can(AbilityAction.Create, 'CommentThread');
|
||||
can(AbilityAction.Update, 'CommentThread', { workspaceId: workspace.id });
|
||||
|
||||
// Comment
|
||||
can(AbilityAction.Read, 'Comment', { workspaceId: workspace.id });
|
||||
|
||||
@ -46,10 +46,11 @@ export class CompanyResolver {
|
||||
): Promise<Partial<Company>[]> {
|
||||
return this.companyService.findMany({
|
||||
...args,
|
||||
where: {
|
||||
...args.where,
|
||||
AND: [accessibleBy(ability).Company],
|
||||
},
|
||||
where: args.where
|
||||
? {
|
||||
AND: [args.where, accessibleBy(ability).Company],
|
||||
}
|
||||
: accessibleBy(ability).Company,
|
||||
select: prismaSelect.value,
|
||||
});
|
||||
}
|
||||
|
||||
@ -48,10 +48,11 @@ export class PersonResolver {
|
||||
): Promise<Partial<Person>[]> {
|
||||
return this.personService.findMany({
|
||||
...args,
|
||||
where: {
|
||||
...args.where,
|
||||
AND: [accessibleBy(ability).Person],
|
||||
},
|
||||
where: args.where
|
||||
? {
|
||||
AND: [args.where, accessibleBy(ability).Person],
|
||||
}
|
||||
: accessibleBy(ability).Person,
|
||||
select: prismaSelect.value,
|
||||
});
|
||||
}
|
||||
|
||||
@ -45,11 +45,11 @@ export class PipelineProgressResolver {
|
||||
): Promise<Partial<PipelineProgress>[]> {
|
||||
return this.pipelineProgressService.findMany({
|
||||
...args,
|
||||
where: {
|
||||
...args.where,
|
||||
AND: [accessibleBy(ability).PipelineProgress],
|
||||
},
|
||||
select: prismaSelect.value,
|
||||
where: args.where
|
||||
? {
|
||||
AND: [args.where, accessibleBy(ability).PipelineProgress],
|
||||
}
|
||||
: accessibleBy(ability).PipelineProgress,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -31,10 +31,11 @@ export class PipelineStageResolver {
|
||||
): Promise<Partial<PipelineStage>[]> {
|
||||
return this.pipelineStageService.findMany({
|
||||
...args,
|
||||
where: {
|
||||
...args.where,
|
||||
AND: [accessibleBy(ability).PipelineStage],
|
||||
},
|
||||
where: args.where
|
||||
? {
|
||||
AND: [args.where, accessibleBy(ability).PipelineStage],
|
||||
}
|
||||
: accessibleBy(ability).PipelineStage,
|
||||
select: prismaSelect.value,
|
||||
});
|
||||
}
|
||||
|
||||
@ -31,10 +31,11 @@ export class PipelineResolver {
|
||||
): Promise<Partial<Pipeline>[]> {
|
||||
return this.pipelineService.findMany({
|
||||
...args,
|
||||
where: {
|
||||
...args.where,
|
||||
AND: [accessibleBy(ability).Pipeline],
|
||||
},
|
||||
where: args.where
|
||||
? {
|
||||
AND: [args.where, accessibleBy(ability).Pipeline],
|
||||
}
|
||||
: accessibleBy(ability).Pipeline,
|
||||
select: prismaSelect.value,
|
||||
});
|
||||
}
|
||||
|
||||
@ -38,10 +38,11 @@ export class UserResolver {
|
||||
): Promise<Partial<User>[]> {
|
||||
return await this.userService.findMany({
|
||||
...args,
|
||||
where: {
|
||||
...args.where,
|
||||
AND: [accessibleBy(ability).User],
|
||||
},
|
||||
where: args.where
|
||||
? {
|
||||
AND: [args.where, accessibleBy(ability).User],
|
||||
}
|
||||
: accessibleBy(ability).User,
|
||||
select: prismaSelect.value,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user