Secured moderation and admin pages by role

This commit is contained in:
Grzegorz Leoniec 2019-01-18 10:35:48 +01:00
parent 9a63da733f
commit e6326f772b
No known key found for this signature in database
GPG Key ID: 3AA43686D4EB1377
4 changed files with 12 additions and 0 deletions

5
middleware/isAdmin.js Normal file
View File

@ -0,0 +1,5 @@
export default ({ store, error }) => {
if (!store.getters['auth/isAdmin']) {
return error({ statusCode: 403 })
}
}

View File

@ -0,0 +1,5 @@
export default ({ store, error }) => {
if (!store.getters['auth/isModerator']) {
return error({ statusCode: 403 })
}
}

View File

@ -21,6 +21,7 @@
<script>
export default {
middleware: ['isAdmin'],
computed: {
routes() {
return [

View File

@ -21,6 +21,7 @@
<script>
export default {
middleware: ['isModerator'],
computed: {
routes() {
return [