Add ByjovePlugin
for sake of $hasPerm()
method
hopefully this will be home to more things over time?
This commit is contained in:
parent
7664f9bbb9
commit
777f877dd5
|
@ -1,4 +1,5 @@
|
|||
|
||||
export * from './plugin'
|
||||
export * from './components'
|
||||
|
||||
export {ByjoveStoreConfig} from './store'
|
||||
|
|
18
src/plugin.js
Normal file
18
src/plugin.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
export function ByjovePlugin(Vue) {
|
||||
Vue.mixin({
|
||||
methods: {
|
||||
|
||||
$hasPerm(name) {
|
||||
|
||||
// if user is root then assume permission
|
||||
if (this.$store.state.user_is_root) {
|
||||
return true
|
||||
}
|
||||
|
||||
// otherwise do true perm check for user
|
||||
return this.$store.state.permissions.includes(name)
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue