feat/role-check: wip
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
||||
# Build Stage
|
||||
FROM node:20-alpine AS build-stage
|
||||
|
||||
# Set the working directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# Enable pnpm using corepack
|
||||
RUN corepack enable
|
||||
|
||||
# Copy pnpm related files and package.json to leverage Docker layer caching
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
|
||||
# Install dependencies using pnpm
|
||||
# Using --frozen-lockfile ensures consistent installations based on pnpm-lock.yaml
|
||||
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store pnpm install --frozen-lockfile
|
||||
|
||||
# Copy the rest of the application files
|
||||
COPY . .
|
||||
|
||||
# Build the Vue.js application for production
|
||||
RUN pnpm build
|
||||
|
||||
# Production Stage
|
||||
FROM nginx:stable-alpine AS production-stage
|
||||
|
||||
# Copy the built Vue.js application from the build stage to Nginx's web root
|
||||
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
||||
|
||||
# Expose port 80 for Nginx
|
||||
EXPOSE 80
|
||||
|
||||
# Command to run Nginx in the foreground
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -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'],
|
||||
},
|
||||
}
|
||||
@@ -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',
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user