Commit a7956ca1 authored by Eliot Berriot's avatar Eliot Berriot 💬

Merge branch '597-sidebar' into 'develop'

Fix #597: Ensure admin links in sidebar are displayed for users with relavant…

Closes #597

See merge request !462
parents 1aa3630b 66c8e7a9
Ensure admin links in sidebar are displayed for users with relavant permissions, and only them (#597)
......@@ -76,18 +76,16 @@
class="item" :to="{name: 'content.index'}"><i class="upload icon"></i><translate>Add content</translate></router-link>
</div>
</div>
<div class="item" v-if="showAdmin">
<div class="item" v-if="$store.state.auth.availablePermissions['settings']">
<div class="header"><translate>Administration</translate></div>
<div class="menu">
<router-link
class="item"
v-if="$store.state.auth.availablePermissions['settings']"
:to="{path: '/manage/settings'}">
<i class="settings icon"></i><translate>Settings</translate>
</router-link>
<router-link
class="item"
v-if="$store.state.auth.availablePermissions['settings']"
:to="{name: 'manage.users.users.list'}">
<i class="users icon"></i><translate>Users</translate>
</router-link>
......@@ -184,7 +182,6 @@ export default {
tracksChangeBuffer: null,
isCollapsed: true,
fetchInterval: null,
showAdmin: this.getShowAdmin()
}
},
mounted () {
......@@ -228,16 +225,6 @@ export default {
...mapActions({
cleanTrack: 'queue/cleanTrack'
}),
getShowAdmin () {
let adminPermissions = [
this.$store.state.auth.availablePermissions['federation'],
this.$store.state.auth.availablePermissions['library'],
this.$store.state.auth.availablePermissions['upload']
]
return adminPermissions.filter(e => {
return e
}).length > 0
},
reorder: function (event) {
this.$store.commit('queue/reorder', {
tracks: this.tracksChangeBuffer, oldIndex: event.oldIndex, newIndex: event.newIndex})
......@@ -271,12 +258,6 @@ export default {
this.scrollToCurrent()
}
},
'$store.state.auth.availablePermissions': {
handler () {
this.showAdmin = this.getShowAdmin()
},
deep: true
}
}
}
</script>
......
......@@ -8,7 +8,12 @@ export default {
state: {
authenticated: false,
username: '',
availablePermissions: {},
availablePermissions: {
federation: false,
settings: false,
library: false,
upload: false
},
profile: null,
token: '',
tokenData: {}
......@@ -27,6 +32,7 @@ export default {
state.tokenData = {}
state.availablePermissions = {
federation: false,
settings: false,
library: false,
upload: false
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment