byjove/src/plugin.js
Lance Edgar 777f877dd5 Add ByjovePlugin for sake of $hasPerm() method
hopefully this will be home to more things over time?
2020-02-11 11:05:31 -06:00

19 lines
425 B
JavaScript

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)
},
}
})
}