feat: enforce role section permissions and add a leads permission

Unticking a section hides it from the menu, closes its routes and blocks its writes on the server; existing roles keep their current access via migration.
This commit is contained in:
2026-10-21 13:45:16 +03:30
parent 631a3267d1
commit 7ae6a5837a
23 changed files with 246 additions and 24 deletions
+7 -1
View File
@@ -64,6 +64,12 @@ const RETENTION_OPTIONS: Array<{ value: DeletionRetention; label: string }> = [
const router = useRouter();
const auth = useAuthStore();
const isOwner = computed(() => auth.user?.role === 'owner');
/** ورود و خروج فقط برای مالک و مدیر؛ بقیه با مجوز «لاگ فعالیت» فقط لاگ‌ها را می‌بینند */
const visibleTabs = computed(() =>
auth.user?.role === 'owner' || auth.user?.role === 'admin'
? TABS
: TABS.filter((item) => item.key !== 'attendance'),
);
const loading = ref(false);
const savingRetention = ref(false);
@@ -366,7 +372,7 @@ onMounted(() => {
<nav class="tabs" aria-label="نوع رویداد">
<button
v-for="item in TABS"
v-for="item in visibleTabs"
:key="item.key"
type="button"
:class="{ on: tab === item.key }"