feat/role-check: wip

This commit is contained in:
2025-12-11 10:11:58 +07:00
parent ee06f42c06
commit 9bf7dacf55
4 changed files with 51 additions and 21 deletions
+16
View File
@@ -0,0 +1,16 @@
import type { Permission } from "~/models/role";
// Should we define the keys first?
// export type Keys = 'key1' | 'key2' | 'key3' | etc
export const permissions: Record<string, Record<string, Permission[]>> = {
'/client/patient': {
'emp|reg': ['C','R','U','D'],
},
'/client/patient/add': {
'emp|reg': ['C','R','U','D'],
},
'/client/patient/{id}': {
'emp|reg': ['C','R','U','D'],
},
}
-19
View File
@@ -66,12 +66,6 @@ const defaultKeys: Record<string, any> = {
classCode: ['ambulatory', 'emergency', 'inpatient'],
unit: 'all',
},
// earlyNurseryAssessment: {
// id: 'early-nursery-assessment',
// title: 'Pengkajian Awal Keperawatan',
// classCode: ['ambulatory', 'emergency', 'inpatient'],
// unit: 'all',
// },
earlyMedicalAssessment: {
id: 'early-medical-assessment',
title: 'Pengkajian Awal Medis',
@@ -85,19 +79,6 @@ const defaultKeys: Record<string, any> = {
unit: 'rehab',
afterId: 'early-medical-assessment',
},
// functionAssessment: {
// id: 'function-assessment',
// title: 'Asesmen Fungsi',
// classCode: ['ambulatory'],
// unit: 'rehab',
// afterId: 'rehab-medical-assessment',
// },
// therapyProtocol: {
// id: 'therapy-protocol',
// classCode: ['ambulatory'],
// title: 'Protokol Terapi',
// unit: 'rehab',
// afterId: 'function-assessment',
initialNursesAssessment: {
id: 'early-nurse-assessment',
title: 'Kajian Awal Keperawatan',
+2 -2
View File
@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { PagePermission } from '~/models/role'
import Error from '~/components/pub/my-ui/error/error.vue'
import { PAGE_PERMISSIONS } from '~/lib/page-permission'
import { permissions } from '~/const/page-permission/client'
definePageMeta({
middleware: ['rbac'],
@@ -16,7 +16,7 @@ useHead({
title: () => route.meta.title as string,
})
const roleAccess: PagePermission = PAGE_PERMISSIONS['/patient']
const roleAccess: PagePermission = permissions['/client/patient/add']
const { checkRole, hasReadAccess } = useRBAC()