Add ByjovePlugin for sake of $hasPerm() method

hopefully this will be home to more things over time?
This commit is contained in:
Lance Edgar 2020-02-11 11:05:31 -06:00
parent 7664f9bbb9
commit 777f877dd5
2 changed files with 19 additions and 0 deletions

View file

@ -1,4 +1,5 @@
export * from './plugin'
export * from './components'
export {ByjoveStoreConfig} from './store'

18
src/plugin.js Normal file
View 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)
},
}
})
}