diff --git a/apps/api/src/common/data-access.ts b/apps/api/src/common/data-access.ts
index 6c10b18..475a96d 100644
--- a/apps/api/src/common/data-access.ts
+++ b/apps/api/src/common/data-access.ts
@@ -115,9 +115,7 @@ export function buildContactRuleWhere(
if (!ids.length) return null;
and.push(ids.length === 1 ? { ownerId: ids[0]! } : { ownerId: { in: ids } });
}
- if (rule.groupIds?.length) {
- and.push({ groupLinks: { some: { groupId: { in: rule.groupIds } } } });
- }
+ // groupIds دیگر فیلتر دسترسی نیست؛ دید گروه فقط از مسئولگروه (personViaGroupAssignee)
if (rule.sources?.length) {
and.push({
OR: [{ importSource: { in: rule.sources } }, { sourceRef: { in: rule.sources } }],
@@ -188,20 +186,13 @@ export function customersCompanyWhere(
if (!ids.length) continue;
and.push(ids.length === 1 ? { ownerId: ids[0]! } : { ownerId: { in: ids } });
}
- if (rule.groupIds?.length) {
- and.push({ groupLinks: { some: { groupId: { in: rule.groupIds } } } });
- }
+ // groupIds دیگر فیلتر دسترسی نیست؛ دید گروه فقط از مسئولگروه (companyViaGroupAssignee)
if (rule.sources?.length) {
and.push({
OR: [{ importSource: { in: rule.sources } }, { sourceRef: { in: rule.sources } }],
});
}
- if (
- rule.moods?.length &&
- !rule.owners?.length &&
- !rule.groupIds?.length &&
- !rule.sources?.length
- ) {
+ if (rule.moods?.length && !rule.owners?.length && !rule.sources?.length) {
continue;
}
if (!and.length) continue;
@@ -469,9 +460,14 @@ export function sectionOwnerIdUnion(
if (rule.owners?.length) {
sawOwnerRule = true;
for (const id of ownerIdList(rule, ctx)) ids.add(id);
- } else if (rule.groupIds?.length || rule.sources?.length || rule.moods?.length ||
- rule.stageIds?.length || rule.pipelineIds?.length || rule.boardIds?.length ||
- rule.typeIds?.length) {
+ } else if (
+ rule.sources?.length ||
+ rule.moods?.length ||
+ rule.stageIds?.length ||
+ rule.pipelineIds?.length ||
+ rule.boardIds?.length ||
+ rule.typeIds?.length
+ ) {
sawNonOwnerRule = true;
}
}
diff --git a/apps/web/src/components/DataAccessEditor.vue b/apps/web/src/components/DataAccessEditor.vue
index 73571f4..05c7198 100644
--- a/apps/web/src/components/DataAccessEditor.vue
+++ b/apps/web/src/components/DataAccessEditor.vue
@@ -22,7 +22,6 @@ const props = withDefaults(
defineProps<{
modelValue: SectionDataAccess;
section?: DataAccessSection;
- groups?: IdOption[];
stages?: IdOption[];
pipelines?: IdOption[];
boards?: IdOption[];
@@ -36,7 +35,6 @@ const props = withDefaults(
}>(),
{
section: 'customers',
- groups: () => [],
stages: () => [],
pipelines: () => [],
boards: () => [],
@@ -53,9 +51,9 @@ const emit = defineEmits<{
const sectionLabel = computed(() => DATA_ACCESS_SECTION_LABELS[props.section]);
-const showGroups = computed(() => props.section === 'customers');
const showMoods = computed(() => props.section === 'customers');
const showImportSources = computed(() => props.section === 'customers');
+const isCustomers = computed(() => props.section === 'customers');
const showLeadSources = computed(() => props.section === 'leads');
const showNoteTypes = computed(() => props.section === 'notes');
const showTicketStatuses = computed(() => props.section === 'tickets');
@@ -119,9 +117,8 @@ const boardsLegend = computed(() =>
/** چند قانون قدیمی → یک فیلتر (اتحاد گزینهها) برای ویرایش ساده */
function collapseRules(rules: DataAccessRule[]): DataAccessRule {
if (!rules.length) return {};
- if (rules.length === 1) return { ...rules[0]! };
+ if (rules.length === 1) return stripCustomerGroupIds({ ...rules[0]! });
const owners = new Set
تنظیم قبلی چندتکه بود؛ اینجا در یک فیلتر ادغام شده. با ذخیره به همین شکل ساده ثبت میشود.
diff --git a/apps/web/src/components/DataAccessPolicyPanel.vue b/apps/web/src/components/DataAccessPolicyPanel.vue
index bd1c0ac..831e8e8 100644
--- a/apps/web/src/components/DataAccessPolicyPanel.vue
+++ b/apps/web/src/components/DataAccessPolicyPanel.vue
@@ -16,7 +16,6 @@ import {
emptySectionDataAccess,
} from '@mento/shared';
import { api } from '@/lib/api';
-import { useCustomerGroups } from '@/lib/customer-groups';
import DataAccessEditor, { type IdOption } from '@/components/DataAccessEditor.vue';
const props = defineProps<{
@@ -85,7 +84,6 @@ function setSection(key: DataAccessSection, next: SectionDataAccess) {
});
}
-const { groups: customerGroups, load: loadCustomerGroups } = useCustomerGroups();
const importSources = ref