Verified Commit 4ce6715d authored by Eliot Berriot's avatar Eliot Berriot
Browse files

See #152: updated front-end to use new permissions

parent 6fc4275b
......@@ -15,7 +15,7 @@
</p>
<router-link
class="ui button"
v-if="$store.state.auth.availablePermissions['settings.change']"
v-if="$store.state.auth.availablePermissions['settings']"
:to="{path: '/manage/settings', hash: 'instance'}">
<i class="pencil icon"></i>{{ $t('Edit instance info') }}
</router-link>
......
......@@ -60,7 +60,7 @@
<div class="menu">
<router-link
class="item"
v-if="$store.state.auth.availablePermissions['import.launch']"
v-if="$store.state.auth.availablePermissions['library']"
:to="{name: 'library.requests', query: {status: 'pending' }}">
<i class="download icon"></i>{{ $t('Import requests') }}
<div
......@@ -70,7 +70,7 @@
</router-link>
<router-link
class="item"
v-if="$store.state.auth.availablePermissions['federation.manage']"
v-if="$store.state.auth.availablePermissions['federation']"
:to="{path: '/manage/federation/libraries'}">
<i class="sitemap icon"></i>{{ $t('Federation') }}
<div
......@@ -80,7 +80,7 @@
</router-link>
<router-link
class="item"
v-if="$store.state.auth.availablePermissions['settings.change']"
v-if="$store.state.auth.availablePermissions['settings']"
:to="{path: '/manage/settings'}">
<i class="settings icon"></i>{{ $t('Settings') }}
</router-link>
......@@ -192,8 +192,8 @@ export default {
}),
showAdmin () {
let adminPermissions = [
this.$store.state.auth.availablePermissions['federation.manage'],
this.$store.state.auth.availablePermissions['import.launch']
this.$store.state.auth.availablePermissions['federation'],
this.$store.state.auth.availablePermissions['library']
]
return adminPermissions.filter(e => {
return e
......@@ -209,7 +209,7 @@ export default {
this.fetchFederationImportRequestsCount()
},
fetchFederationNotificationsCount () {
if (!this.$store.state.auth.availablePermissions['federation.manage']) {
if (!this.$store.state.auth.availablePermissions['federation']) {
return
}
let self = this
......@@ -218,7 +218,7 @@ export default {
})
},
fetchFederationImportRequestsCount () {
if (!this.$store.state.auth.availablePermissions['import.launch']) {
if (!this.$store.state.auth.availablePermissions['library']) {
return
}
let self = this
......
......@@ -13,10 +13,10 @@
exact>
<i18next path="Requests"/>
</router-link>
<router-link v-if="$store.state.auth.availablePermissions['import.launch']" class="ui item" to="/library/import/launch" exact>
<router-link v-if="$store.state.auth.availablePermissions['library']" class="ui item" to="/library/import/launch" exact>
<i18next path="Import"/>
</router-link>
<router-link v-if="$store.state.auth.availablePermissions['import.launch']" class="ui item" to="/library/import/batches">
<router-link v-if="$store.state.auth.availablePermissions['library']" class="ui item" to="/library/import/batches">
<i18next path="Import batches"/>
</router-link>
</div>
......
......@@ -22,7 +22,7 @@
</span>
<button
@click="createImport"
v-if="request.status === 'pending' && importAction && $store.state.auth.availablePermissions['import.launch']"
v-if="request.status === 'pending' && importAction && $store.state.auth.availablePermissions['library']"
class="ui mini basic green right floated button">{{ $t('Create import') }}</button>
</div>
......
......@@ -112,7 +112,7 @@ export default {
dispatch('playlists/fetchOwn', null, {root: true})
Object.keys(data.permissions).forEach(function (key) {
// this makes it easier to check for permissions in templates
commit('permission', {key, status: data.permissions[String(key)].status})
commit('permission', {key, status: data.permissions[String(key)]})
})
return response.data
}, (response) => {
......
......@@ -164,9 +164,7 @@ describe('store/auth', () => {
const profile = {
username: 'bob',
permissions: {
admin: {
status: true
}
admin: true
}
}
moxios.stubRequest('users/users/me/', {
......
Supports Markdown
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