Skip to content

Commit

Permalink
add permission middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
reyniersbram committed May 23, 2024
1 parent bd38d8e commit db06778
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions frontend/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import useCanVisit, {
useOrCondition,
useIsInGroupOfProjectCondition,
useIsTeacherCondition,
useAndCondition,
} from "./middleware/canVisit";

declare module "vue-router" {
Expand Down Expand Up @@ -133,6 +134,9 @@ const router = createRouter({
name: "edit-subject",
component: () => import("../views/subject/modify/PatchSubjectView.vue"),
props: (route) => ({ subjectId: Number(route.params.subjectId) }),
meta: {
middleware: useCanVisit(useAndCondition(useIsTeacherCondition, useIsInstructorOfSubjectCondition)),
}
},
{
path: "/subjects/:subjectId(\\d+)",
Expand Down

0 comments on commit db06778

Please sign in to comment.