diff --git a/frontend/src/components/Menu/Sidebar.spec.js b/frontend/src/components/Menu/Sidebar.spec.js
index a978be0bb..23c855557 100644
--- a/frontend/src/components/Menu/Sidebar.spec.js
+++ b/frontend/src/components/Menu/Sidebar.spec.js
@@ -14,7 +14,7 @@ describe('Sidebar', () => {
$store: {
state: {
hasElopage: true,
- isAdmin: false,
+ roles: [],
},
},
}
@@ -83,7 +83,7 @@ describe('Sidebar', () => {
describe('for admin users', () => {
beforeAll(() => {
- mocks.$store.state.isAdmin = true
+ mocks.$store.state.roles = ['admin']
wrapper = Wrapper()
})
diff --git a/frontend/src/components/Menu/Sidebar.vue b/frontend/src/components/Menu/Sidebar.vue
index b43afd9f9..73eea1015 100644
--- a/frontend/src/components/Menu/Sidebar.vue
+++ b/frontend/src/components/Menu/Sidebar.vue
@@ -49,12 +49,14 @@
- {{ $t('navigation.admin_area') }}
+
+ {{ $t('navigation.admin_area') }}
+
{
- state.isAdmin = !!isAdmin
+ roles(state, roles) {
+ state.roles = roles
},
hasElopage: (state, hasElopage) => {
state.hasElopage = hasElopage
@@ -70,7 +70,7 @@ export const actions = {
commit('newsletterState', data.klickTipp.newsletterState)
commit('hasElopage', data.hasElopage)
commit('publisherId', data.publisherId)
- commit('isAdmin', data.isAdmin)
+ commit('roles', data.roles)
commit('hideAmountGDD', data.hideAmountGDD)
commit('hideAmountGDT', data.hideAmountGDT)
commit('setDarkMode', data.darkMode)
@@ -84,7 +84,7 @@ export const actions = {
commit('newsletterState', null)
commit('hasElopage', false)
commit('publisherId', null)
- commit('isAdmin', false)
+ commit('roles', null)
commit('hideAmountGDD', false)
commit('hideAmountGDT', true)
commit('email', '')
@@ -111,7 +111,7 @@ try {
// username: '',
token: null,
tokenTime: null,
- isAdmin: false,
+ roles: [],
newsletterState: null,
hasElopage: false,
publisherId: null,
diff --git a/frontend/src/store/store.test.js b/frontend/src/store/store.test.js
index e72b984f7..6a765cc3f 100644
--- a/frontend/src/store/store.test.js
+++ b/frontend/src/store/store.test.js
@@ -29,7 +29,7 @@ const {
username,
newsletterState,
publisherId,
- isAdmin,
+ roles,
hasElopage,
hideAmountGDD,
hideAmountGDT,
@@ -136,11 +136,11 @@ describe('Vuex store', () => {
})
})
- describe('isAdmin', () => {
- it('sets the state of isAdmin', () => {
- const state = { isAdmin: null }
- isAdmin(state, true)
- expect(state.isAdmin).toEqual(true)
+ describe('roles', () => {
+ it('sets the state of roles', () => {
+ const state = { roles: [] }
+ roles(state, ['admin'])
+ expect(state.roles).toEqual(['admin'])
})
})
@@ -192,7 +192,7 @@ describe('Vuex store', () => {
},
hasElopage: false,
publisherId: 1234,
- isAdmin: true,
+ roles: ['admin'],
hideAmountGDD: false,
hideAmountGDT: true,
}
@@ -242,9 +242,9 @@ describe('Vuex store', () => {
expect(commit).toHaveBeenNthCalledWith(8, 'publisherId', 1234)
})
- it('commits isAdmin', () => {
+ it('commits roles', () => {
login({ commit, state }, commitedData)
- expect(commit).toHaveBeenNthCalledWith(9, 'isAdmin', true)
+ expect(commit).toHaveBeenNthCalledWith(9, 'roles', ['admin'])
})
it('commits hideAmountGDD', () => {
@@ -307,9 +307,9 @@ describe('Vuex store', () => {
expect(commit).toHaveBeenNthCalledWith(8, 'publisherId', null)
})
- it('commits isAdmin', () => {
+ it('commits roles', () => {
logout({ commit, state })
- expect(commit).toHaveBeenNthCalledWith(9, 'isAdmin', false)
+ expect(commit).toHaveBeenNthCalledWith(9, 'roles', null)
})
it('commits hideAmountGDD', () => {