Add user_is_admin flag to app store, plus logic to set/clear it

This commit is contained in:
Lance Edgar 2020-02-11 13:33:54 -06:00
parent a80a42fb56
commit 3c4e9567a9
4 changed files with 24 additions and 2 deletions

View file

@ -3,6 +3,23 @@ export function ByjovePlugin(Vue) {
Vue.mixin({
methods: {
$loginUser(user) {
// put user info in app store
this.$store.commit('SET_USER', user)
this.$store.commit('SET_USER_IS_ADMIN', user.is_admin)
// note, this should already be false
// this.$store.commit('SET_USER_IS_ROOT', false)
},
$logoutUser() {
// remove user info from app store
this.$store.commit('SET_USER', null)
this.$store.commit('SET_USER_IS_ADMIN', false)
this.$store.commit('SET_USER_IS_ROOT', false)
},
$hasPerm(name) {
// if user is root then assume permission