Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -173,6 +173,7 @@ import { usePermissionStore } from 'stores/permissionStore'
|
||||
import { useI18n } from 'src/composables/useI18n'
|
||||
import { UI_LANGUAGE_OPTIONS } from 'src/i18n/languages'
|
||||
import { useLocaleStore } from 'src/stores/localeStore'
|
||||
import { activityLogsMenuItem, getAuthUserId } from 'src/modules/activityLogs'
|
||||
|
||||
|
||||
/* ================= STORES ================= */
|
||||
@@ -365,18 +366,6 @@ const menuItems = [
|
||||
permission: 'system:update'
|
||||
},
|
||||
|
||||
{
|
||||
label: 'Loglar',
|
||||
to: '/app/activity-logs',
|
||||
permission: 'system:read'
|
||||
},
|
||||
|
||||
{
|
||||
label: 'Test Mail',
|
||||
to: '/app/test-mail',
|
||||
permission: 'system:update'
|
||||
},
|
||||
|
||||
{
|
||||
label: 'Piyasa Mail Eşleştirme',
|
||||
to: '/app/market-mail-mapping',
|
||||
@@ -385,6 +374,27 @@ const menuItems = [
|
||||
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
label: 'SüperAdmin',
|
||||
icon: 'admin_panel_settings',
|
||||
onlyUserIds: activityLogsMenuItem.onlyUserIds,
|
||||
|
||||
children: [
|
||||
{
|
||||
label: 'Log İzleme',
|
||||
to: activityLogsMenuItem.to,
|
||||
permission: activityLogsMenuItem.permission,
|
||||
onlyUserIds: activityLogsMenuItem.onlyUserIds
|
||||
},
|
||||
{
|
||||
label: 'Test Mail',
|
||||
to: '/app/test-mail',
|
||||
permission: 'system:update',
|
||||
onlyUserIds: activityLogsMenuItem.onlyUserIds
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Dil Çeviri',
|
||||
icon: 'translate',
|
||||
@@ -416,6 +426,16 @@ const menuItems = [
|
||||
|
||||
/* ================= FILTERED MENU ================= */
|
||||
|
||||
function isAllowedForUser (item) {
|
||||
const only = item?.onlyUserIds
|
||||
if (!Array.isArray(only) || only.length === 0) return true
|
||||
|
||||
const id = getAuthUserId(auth.user)
|
||||
if (id == null) return false
|
||||
|
||||
return only.includes(id)
|
||||
}
|
||||
|
||||
const filteredMenu = computed(() => {
|
||||
|
||||
if (!perm.loaded) return []
|
||||
@@ -424,9 +444,10 @@ const filteredMenu = computed(() => {
|
||||
.map(item => {
|
||||
|
||||
if (item.children) {
|
||||
if (!isAllowedForUser(item)) return null
|
||||
|
||||
const children = item.children.filter(c =>
|
||||
perm.hasApiPermission(c.permission)
|
||||
isAllowedForUser(c) && perm.hasApiPermission(c.permission)
|
||||
)
|
||||
|
||||
if (!children.length) return null
|
||||
@@ -437,6 +458,10 @@ const filteredMenu = computed(() => {
|
||||
}
|
||||
}
|
||||
|
||||
if (!isAllowedForUser(item)) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (!perm.hasApiPermission(item.permission)) {
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user