Browse Source

Remove middleware duplication, resolves #672

pull/673/head
Hironsan 4 years ago
parent
commit
a20a1df9a7
8 changed files with 6 additions and 14 deletions
  1. 2
      frontend/layouts/project.vue
  2. 6
      frontend/middleware/check-admin.js
  3. 2
      frontend/pages/projects/_id/dataset/index.vue
  4. 2
      frontend/pages/projects/_id/guideline/index.vue
  5. 2
      frontend/pages/projects/_id/index.vue
  6. 2
      frontend/pages/projects/_id/labels/index.vue
  7. 2
      frontend/pages/projects/_id/members/index.vue
  8. 2
      frontend/pages/projects/_id/statistics/index.vue

2
frontend/layouts/project.vue

@ -41,6 +41,8 @@ import TheSideBar from '~/components/organisms/layout/TheSideBar'
import TheHeader from '~/components/organisms/layout/TheHeader'
export default {
middleware: ['check-auth', 'auth', 'check-admin'],
components: {
TheSideBar,
TheHeader

6
frontend/middleware/check-admin.js

@ -1,6 +1,8 @@
export default function ({ store, route, redirect }) {
const role = store.getters['projects/getCurrentUserRole']
if (!role.is_project_admin) {
redirect('/projects/' + route.params.id)
const projectRoot = '/projects/' + route.params.id
const path = route.fullPath.replace(/\/$/g, '')
if (!role.is_project_admin && path !== projectRoot) {
return redirect(projectRoot)
}
}

2
frontend/pages/projects/_id/dataset/index.vue

@ -16,8 +16,6 @@ import DocumentDeletionButton from '@/components/containers/documents/DocumentDe
export default {
layout: 'project',
middleware: ['check-auth', 'auth', 'check-admin'],
components: {
DocumentList,
DocumentActionMenu,

2
frontend/pages/projects/_id/guideline/index.vue

@ -17,8 +17,6 @@ import { mapState, mapActions } from 'vuex'
export default {
layout: 'project',
middleware: ['check-auth', 'auth', 'check-admin'],
components: {
Editor
},

2
frontend/pages/projects/_id/index.vue

@ -54,8 +54,6 @@
export default {
layout: 'project',
middleware: ['check-auth', 'auth'],
data() {
return {
e6: 1,

2
frontend/pages/projects/_id/labels/index.vue

@ -16,8 +16,6 @@ import LabelDeletionButton from '@/components/containers/labels/LabelDeletionBut
export default {
layout: 'project',
middleware: ['check-auth', 'auth', 'check-admin'],
components: {
LabelList,
LabelActionMenu,

2
frontend/pages/projects/_id/members/index.vue

@ -16,8 +16,6 @@ import MemberDeletionButton from '@/components/containers/members/MemberDeletion
export default {
layout: 'project',
middleware: ['check-auth', 'auth', 'check-admin'],
components: {
MemberList,
MemberAdditionButton,

2
frontend/pages/projects/_id/statistics/index.vue

@ -41,8 +41,6 @@ import BarChart from '@/components/molecules/BarChart'
export default {
layout: 'project',
middleware: ['check-auth', 'auth', 'check-admin'],
components: {
DoughnutChart,
BarChart

Loading…
Cancel
Save