Add user_is_admin flag to app store, plus logic to set/clear it
This commit is contained in:
parent
a80a42fb56
commit
3c4e9567a9
4 changed files with 24 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue