chore: commit pending admin-panel, api auth and parity doc changes

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
s.esmaeili
2026-10-14 04:33:24 +03:30
co-authored by Claude Haiku 5.5
parent 55856cac89
commit cf014e1f6c
41 changed files with 3471 additions and 969 deletions
+18 -2
View File
@@ -97,6 +97,7 @@ export const adminRoute: RouteRecordRaw[] = [
pageTitle: 'مدیریت کیف پول',
rule: 'editor',
role: 'config.wallet',
superAdminOnly: true,
parent: 'manage',
no_scroll: true
}
@@ -283,6 +284,7 @@ export const adminRoute: RouteRecordRaw[] = [
meta: {
rule: 'editor',
role: 'order.list',
superAdminOnly: true,
parent: 'order',
no_scroll: true
}
@@ -313,6 +315,7 @@ export const adminRoute: RouteRecordRaw[] = [
meta: {
rule: 'editor',
role: 'order.create',
superAdminOnly: true,
parent: 'order',
no_scroll: true
}
@@ -363,6 +366,7 @@ export const adminRoute: RouteRecordRaw[] = [
meta: {
rule: 'editor',
role: 'offers.create.tak',
superAdminOnly: true,
//parent: 'order',
no_scroll: true
}
@@ -373,6 +377,7 @@ export const adminRoute: RouteRecordRaw[] = [
meta: {
rule: 'editor',
role: 'offers.list.tak.edit',
superAdminOnly: true,
//parent: 'order',
no_scroll: true
}
@@ -566,6 +571,7 @@ export const adminRoute: RouteRecordRaw[] = [
meta: {
rule: 'editor',
role: 'persons.list.client.single.edit',
superAdminOnly: true,
parent: 'product',
no_scroll: true
}
@@ -577,6 +583,7 @@ export const adminRoute: RouteRecordRaw[] = [
meta: {
rule: 'editor',
role: 'persons.list.client.single.view',
superAdminOnly: true,
parent: 'product',
no_scroll: true
}
@@ -638,7 +645,8 @@ export const adminRoute: RouteRecordRaw[] = [
],
pageTitle: 'لیست بنکداران',
rule: 'editor',
role: 'persons.list.client.omde'
role: 'persons.list.client.omde',
superAdminOnly: true
}
},
{
@@ -658,7 +666,8 @@ export const adminRoute: RouteRecordRaw[] = [
],
pageTitle: 'لیست مغازه داران حضوری',
rule: 'editor',
role: 'persons.list.client.omde'
role: 'persons.list.client.omde',
superAdminOnly: true
}
},
{
@@ -736,6 +745,7 @@ export const adminRoute: RouteRecordRaw[] = [
],
pageTitle: 'لیست مشتریان',
role: 'persons.list.client.single',
superAdminOnly: true,
rule: 'editor'
}
},
@@ -965,6 +975,7 @@ export const adminRoute: RouteRecordRaw[] = [
],
pageTitle: 'افزودن شعب',
role: 'branch.create',
superAdminOnly: true,
rule: 'editor'
}
},
@@ -975,6 +986,7 @@ export const adminRoute: RouteRecordRaw[] = [
meta: {
pageTitle: 'ویرایش شعب',
role: 'branch.create',
superAdminOnly: true,
rule: 'editor'
}
},
@@ -996,6 +1008,7 @@ export const adminRoute: RouteRecordRaw[] = [
],
pageTitle: 'لیست شعب',
role: 'branch.list',
superAdminOnly: true,
rule: 'editor'
}
},
@@ -1018,6 +1031,7 @@ export const adminRoute: RouteRecordRaw[] = [
],
pageTitle: 'افزودن کارگاه',
role: 'workshop.create',
superAdminOnly: true,
rule: 'editor'
}
},
@@ -1028,6 +1042,7 @@ export const adminRoute: RouteRecordRaw[] = [
meta: {
pageTitle: 'ویرایش کارگاه',
role: 'workshop.create',
superAdminOnly: true,
rule: 'editor'
}
},
@@ -1049,6 +1064,7 @@ export const adminRoute: RouteRecordRaw[] = [
],
pageTitle: 'لیست کارگاه ها',
role: 'workshop.list',
superAdminOnly: true,
rule: 'editor'
}
},
+4
View File
@@ -92,6 +92,7 @@ async function getPermission(): Promise<string[] | undefined> {
try {
const { data } = await api.get('users/show');
users.getRoles(data.permission);
users.setSuperAdmin(data.is_super_admin);
// Legacy stripped these before caching the user blob.
delete data.permission;
delete data.ut;
@@ -149,6 +150,9 @@ router.beforeEach(async (to) => {
const token = localStorage.getItem(tokenName);
if (token) {
const roles = await getPermission();
if (to.meta?.superAdminOnly && !useUsersStore().isSuperAdmin) {
return { name: 'page-not-authorized' };
}
if (roles && to.meta && to.meta.role && !roles.includes(to.meta.role as string)) {
if (to.name === 'dashboard-ecommerce' || to.name === 'dashboard-analytics') {
return { name: 'my-data' };