Skip to content

Commit

Permalink
Merge pull request #178 from bcgov/bugfix/navigate-enquiry
Browse files Browse the repository at this point in the history
Resolve navigation permission issues
  • Loading branch information
kyle1morel authored Oct 3, 2024
2 parents dbffa2a + 7f3d961 commit 205102d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { label, name, mask, placeholder, disabled, bold } = defineProps<{
label: string;
name: string;
mask: string;
placeholder: string;
placeholder?: string;
disabled: boolean;
bold: boolean;
}>();
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/layout/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type NavItem = {
label: string;
route?: string;
public?: boolean;
access?: string;
access?: NavigationPermission | Array<NavigationPermission>;
items?: Array<NavItem>;
mailTo?: string;
};
Expand All @@ -39,12 +39,12 @@ onMounted(() => {
{
label: 'Start a new project investigation',
route: RouteName.HOUSING_SUBMISSION_INTAKE,
access: NavigationPermission.HOUSING_INTAKE
access: NavigationPermission.HOUSING_SUBMISSION_INTAKE
},
{
label: 'Submit an enquiry',
route: RouteName.HOUSING_ENQUIRY_INTAKE,
access: NavigationPermission.HOUSING_ENQUIRY
access: NavigationPermission.HOUSING_ENQUIRY_INTAKE
},
{
label: 'View my drafts and previous entries',
Expand Down Expand Up @@ -80,7 +80,7 @@ onMounted(() => {
{
label: 'Contact a Navigator',
mailTo: `mailto:${HOUSING_CONTACT.email}?subject=${HOUSING_CONTACT.subject}`,
access: NavigationPermission.HOUSING_INTAKE
access: [NavigationPermission.HOUSING_SUBMISSION_INTAKE, NavigationPermission.HOUSING_ENQUIRY_INTAKE]
},
{
label: 'Report a problem',
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const routes: Array<RouteRecordRaw> = [
beforeEnter: accessHandler,
props: createProps,
meta: {
access: [NavigationPermission.HOUSING_INTAKE]
access: [NavigationPermission.HOUSING_ENQUIRY_INTAKE]
}
}
]
Expand All @@ -138,7 +138,7 @@ const routes: Array<RouteRecordRaw> = [
beforeEnter: accessHandler,
props: createProps,
meta: {
access: [NavigationPermission.HOUSING_INTAKE]
access: [NavigationPermission.HOUSING_SUBMISSION_INTAKE]
}
}
]
Expand Down
17 changes: 12 additions & 5 deletions frontend/src/store/authzStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ export enum NavigationPermission {
HOUSING = 'housing',
HOUSING_DROPDOWN = 'housing.dropdown',
HOUSING_ENQUIRY = 'housing.enquiry',
HOUSING_INTAKE = 'housing.intake',
HOUSING_ENQUIRY_INTAKE = 'housing.enquiry.intake',
HOUSING_SUBMISSION = 'housing.submission',
HOUSING_SUBMISSION_INTAKE = 'housing.submission.intake',
HOUSING_SUBMISSIONS = 'housing.submissions',
HOUSING_SUBMISSIONS_SUB = 'housing.submissions.sub',
HOUSING_STATUS_TRACKER = 'housing.statustracker',
Expand All @@ -26,6 +27,7 @@ const NavigationAuthorizationMap = [
group: GroupName.ADMIN,
permissions: [
NavigationPermission.HOUSING_DROPDOWN,
NavigationPermission.HOUSING_ENQUIRY,
NavigationPermission.HOUSING_STATUS_TRACKER,
NavigationPermission.HOUSING_SUBMISSION,
NavigationPermission.HOUSING_SUBMISSIONS,
Expand All @@ -37,30 +39,35 @@ const NavigationAuthorizationMap = [
group: GroupName.NAVIGATOR,
permissions: [
NavigationPermission.HOUSING_DROPDOWN,
NavigationPermission.HOUSING_ENQUIRY,
NavigationPermission.HOUSING_STATUS_TRACKER,
NavigationPermission.HOUSING_SUBMISSION,
NavigationPermission.HOUSING_SUBMISSIONS
]
},
{
group: GroupName.NAVIGATOR_READ_ONLY,
permissions: [NavigationPermission.HOUSING_SUBMISSION, NavigationPermission.HOUSING_SUBMISSIONS]
permissions: [
NavigationPermission.HOUSING_ENQUIRY,
NavigationPermission.HOUSING_SUBMISSION,
NavigationPermission.HOUSING_SUBMISSIONS
]
},
{
group: GroupName.PROPONENT,
permissions: [
NavigationPermission.HOUSING,
NavigationPermission.HOUSING_DROPDOWN,
NavigationPermission.HOUSING_ENQUIRY,
NavigationPermission.HOUSING_INTAKE,
NavigationPermission.HOUSING_SUBMISSION,
NavigationPermission.HOUSING_ENQUIRY_INTAKE,
NavigationPermission.HOUSING_SUBMISSION_INTAKE,
NavigationPermission.HOUSING_SUBMISSIONS_SUB
]
},
{
group: GroupName.SUPERVISOR,
permissions: [
NavigationPermission.HOUSING_DROPDOWN,
NavigationPermission.HOUSING_ENQUIRY,
NavigationPermission.HOUSING_STATUS_TRACKER,
NavigationPermission.HOUSING_SUBMISSION,
NavigationPermission.HOUSING_SUBMISSIONS,
Expand Down

0 comments on commit 205102d

Please sign in to comment.