Add named teams and per-user data visibility (own/team/org) with settings UI and org module.
This commit is contained in:
@@ -403,13 +403,16 @@ export class SalesService {
|
||||
actor: Actor,
|
||||
filterUserId?: string,
|
||||
): Prisma.SalesGoalWhereInput {
|
||||
if (elevated(actor.role)) {
|
||||
if (elevated(actor.role) || actor.dataVisibility === 'org' || actor.visibleUserIds === null) {
|
||||
if (filterUserId === 'org') return { userId: null };
|
||||
if (filterUserId) return { userId: filterUserId };
|
||||
return {};
|
||||
}
|
||||
const ids = actor.visibleUserIds?.length
|
||||
? actor.visibleUserIds
|
||||
: [actor.userId];
|
||||
return {
|
||||
OR: [{ userId: actor.userId }, { userId: null }],
|
||||
OR: [{ userId: { in: ids } }, { userId: null }],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user