mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
Add roles check to the guards verifyLogin.
This commit is contained in:
parent
bed2b86ea5
commit
1a4c42ea26
@ -13,8 +13,10 @@ const addNavigationGuards = (router, store, apollo, i18n) => {
|
||||
})
|
||||
.then((result) => {
|
||||
const moderator = result.data.verifyLogin
|
||||
if (moderator.isAdmin) {
|
||||
if (moderator.roles.includes('ADMIN', 0) || moderator.roles.includes('MODERATOR', 0)) {
|
||||
i18n.locale = moderator.language
|
||||
moderator.isAdmin = moderator.roles.includes('ADMIN', 0)
|
||||
moderator.isModerator = moderator.roles.includes('MODERATOR', 0)
|
||||
store.commit('moderator', moderator)
|
||||
next({ path: '/' })
|
||||
} else {
|
||||
@ -35,7 +37,7 @@ const addNavigationGuards = (router, store, apollo, i18n) => {
|
||||
!CONFIG.DEBUG_DISABLE_AUTH && // we did not disabled the auth module for debug purposes
|
||||
(!store.state.token || // we do not have a token
|
||||
!store.state.moderator || // no moderator set in store
|
||||
!store.state.moderator.isAdmin) && // user is no admin
|
||||
!(store.state.moderator.isAdmin || store.state.moderator.isModerator)) && // user is no admin
|
||||
to.path !== '/not-found' && // we are not on `not-found`
|
||||
to.path !== '/logout' // we are not on `logout`
|
||||
) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user