Browse Source
Merge pull request #673 from doccano/enhancement/remove-repeated-middleware
Remove middleware duplication
pull/677/head
Hiroki Nakayama
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with
6 additions and
14 deletions
-
frontend/layouts/project.vue
-
frontend/middleware/check-admin.js
-
frontend/pages/projects/_id/dataset/index.vue
-
frontend/pages/projects/_id/guideline/index.vue
-
frontend/pages/projects/_id/index.vue
-
frontend/pages/projects/_id/labels/index.vue
-
frontend/pages/projects/_id/members/index.vue
-
frontend/pages/projects/_id/statistics/index.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 |
|
|
|
|
|
@ -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) |
|
|
|
} |
|
|
|
} |
|
|
@ -16,8 +16,6 @@ import DocumentDeletionButton from '@/components/containers/documents/DocumentDe |
|
|
|
export default { |
|
|
|
layout: 'project', |
|
|
|
|
|
|
|
middleware: ['check-auth', 'auth', 'check-admin'], |
|
|
|
|
|
|
|
components: { |
|
|
|
DocumentList, |
|
|
|
DocumentActionMenu, |
|
|
|
|
|
@ -17,8 +17,6 @@ import { mapState, mapActions } from 'vuex' |
|
|
|
export default { |
|
|
|
layout: 'project', |
|
|
|
|
|
|
|
middleware: ['check-auth', 'auth', 'check-admin'], |
|
|
|
|
|
|
|
components: { |
|
|
|
Editor |
|
|
|
}, |
|
|
|
|
|
@ -54,8 +54,6 @@ |
|
|
|
export default { |
|
|
|
layout: 'project', |
|
|
|
|
|
|
|
middleware: ['check-auth', 'auth'], |
|
|
|
|
|
|
|
data() { |
|
|
|
return { |
|
|
|
e6: 1, |
|
|
|
|
|
@ -16,8 +16,6 @@ import LabelDeletionButton from '@/components/containers/labels/LabelDeletionBut |
|
|
|
export default { |
|
|
|
layout: 'project', |
|
|
|
|
|
|
|
middleware: ['check-auth', 'auth', 'check-admin'], |
|
|
|
|
|
|
|
components: { |
|
|
|
LabelList, |
|
|
|
LabelActionMenu, |
|
|
|
|
|
@ -16,8 +16,6 @@ import MemberDeletionButton from '@/components/containers/members/MemberDeletion |
|
|
|
export default { |
|
|
|
layout: 'project', |
|
|
|
|
|
|
|
middleware: ['check-auth', 'auth', 'check-admin'], |
|
|
|
|
|
|
|
components: { |
|
|
|
MemberList, |
|
|
|
MemberAdditionButton, |
|
|
|
|
|
@ -41,8 +41,6 @@ import BarChart from '@/components/molecules/BarChart' |
|
|
|
export default { |
|
|
|
layout: 'project', |
|
|
|
|
|
|
|
middleware: ['check-auth', 'auth', 'check-admin'], |
|
|
|
|
|
|
|
components: { |
|
|
|
DoughnutChart, |
|
|
|
BarChart |
|
|
|