base structure
This commit is contained in:
123
ui/src/lib/menu.js
Normal file
123
ui/src/lib/menu.js
Normal file
@@ -0,0 +1,123 @@
|
||||
import { useLoginStore } from 'stores/login'
|
||||
const store = useLoginStore()
|
||||
|
||||
|
||||
const tmenu = [
|
||||
{
|
||||
label: 'Şirket Tanımları',
|
||||
icon: 'business',
|
||||
grantKey: 'Company',
|
||||
to: '/company'
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
label:'menu.masterData',
|
||||
icon: 'mdi-database-edit',
|
||||
grantKey: 'Data',
|
||||
to: null,
|
||||
children: [
|
||||
{
|
||||
label: 'menu.fiCrn',
|
||||
icon: 'mdi-server-network',
|
||||
grantKey: 'fiCrn',
|
||||
to: '/ficrn'
|
||||
},
|
||||
{
|
||||
label: 'menu.dfGeo',
|
||||
icon: 'mdi-server-network',
|
||||
grantKey: 'defGeo',
|
||||
to: '/dfgeo'
|
||||
},
|
||||
{
|
||||
label: 'menu.region',
|
||||
icon: 'mdi-server-network',
|
||||
grantKey: 'defGeo',
|
||||
to: '/region'
|
||||
},
|
||||
|
||||
{
|
||||
label: 'menu.translations',
|
||||
icon: 'mdi-translate',
|
||||
grantKey: 'Locale',
|
||||
to: '/locale'
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
label: 'menu.systemManagement',
|
||||
icon: 'build_circle',
|
||||
grantKey: 'System',
|
||||
to: null,
|
||||
children: [
|
||||
{
|
||||
label: 'menu.syusr',
|
||||
icon: 'mdi-badge-account-horizontal',
|
||||
grantKey: 'syUsr',
|
||||
to: '/syusr'
|
||||
},
|
||||
{
|
||||
label: 'menu.syunit',
|
||||
icon: 'mdi-account-group',
|
||||
grantKey: 'syUnit',
|
||||
to: '/syunit'
|
||||
},
|
||||
{
|
||||
label: 'menu.systemParams',
|
||||
icon: 'settings_applications',
|
||||
grantKey: 'syParams',
|
||||
to: '/syparams'
|
||||
},
|
||||
{
|
||||
label: 'Log Auth',
|
||||
icon: 'receipt',
|
||||
grantKey: 'LogAuth',
|
||||
to: '/logauth'
|
||||
},
|
||||
{
|
||||
label: 'Log DML',
|
||||
icon: 'receipt',
|
||||
grantKey: 'LogDML',
|
||||
to: '/logdml'
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
|
||||
export const menu = function () {
|
||||
const m = tmenu.filter(m => {
|
||||
return checkGrant(m.grantKey)
|
||||
})
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
|
||||
const checkGrant = function (typ) {
|
||||
//todo:
|
||||
return true
|
||||
|
||||
if (store.IsAdmin) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (store.grantHasKey(typ)) {
|
||||
const o = store.Grants[typ]
|
||||
for (let [key, value] of Object.entries(o)) {
|
||||
if (value) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const checkRprGrant = function (typ) {
|
||||
if (this.$store.IsAdmin) {
|
||||
return true
|
||||
}
|
||||
|
||||
return store.Grants.Rpr[typ]
|
||||
}
|
||||
Reference in New Issue
Block a user