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
|
@ -43,6 +43,7 @@ export default {
|
|||
|
||||
// let all of app know who the user is(n't)
|
||||
this.$store.commit('SET_USER', response.data.user)
|
||||
this.$store.commit('SET_USER_IS_ADMIN', response.data.user ? response.data.user.is_admin : false)
|
||||
this.$store.commit('SET_USER_IS_ROOT', response.data.user ? response.data.user.is_root : false)
|
||||
|
||||
// also keep track of user's permissions
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<slot></slot>
|
||||
|
||||
<b-dropdown-item v-if="user.is_admin && !user_is_root"
|
||||
<b-dropdown-item v-if="$store.state.user_is_admin && !user_is_root"
|
||||
aria-role="listitem"
|
||||
has-link
|
||||
class="root-user">
|
||||
|
@ -124,7 +124,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
becomeRoot() {
|
||||
if (this.user_is_root || !this.user.is_admin) {
|
||||
if (this.user_is_root || !this.$store.state.user_is_admin) {
|
||||
return
|
||||
}
|
||||
this.$http.post(this.becomeRootUrl).then(response => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue