Skip to content

Commit

Permalink
permissions for new pages
Browse files Browse the repository at this point in the history
  • Loading branch information
reyniersbram committed May 22, 2024
1 parent ff7545e commit 1aa668e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions frontend/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import useCanVisit, {
useIsInstructorOfGroupCondition,
useOrCondition,
useIsInGroupOfProjectCondition,
useIsTeacherCondition,
} from "./middleware/canVisit";

declare module "vue-router" {
Expand Down Expand Up @@ -123,6 +124,9 @@ const router = createRouter({
path: "/subjects/create",
name: "create-subject",
component: () => import("../views/subject/CreateSubjectView.vue"),
meta: {
middleware: useCanVisit(useOrCondition(useIsAdminCondition, useIsTeacherCondition)),
},
},
{
path: "/subjects/:subjectId(\\d+)",
Expand Down Expand Up @@ -152,6 +156,9 @@ const router = createRouter({
name: "edit-project",
component: () => import("../views/CreateProjectView.vue"), // Ensure this is correct
props: (route) => ({ projectId: Number(route.params.projectId), isEditMode: true }),
meta: {
middleware: useCanVisit(useIsInstructorOfProjectCondition),
},
},
{
path: "/subjects/register/:uuid",
Expand Down

0 comments on commit 1aa668e

Please sign in to comment.