feat/page-claning: moved some consts from lib
This commit is contained in:
@@ -17,12 +17,12 @@ export function useRBAC() {
|
||||
|
||||
const checkRole = (roleAccess: RoleAccess, _userRoles?: string[]): boolean => {
|
||||
const roles = authStore.userRole
|
||||
return roles.some((role: string) => (role in roleAccess) || role === 'system') // system by-passes this check
|
||||
return roles.some((role: string) => role === 'system' || (role in roleAccess)) // system by-passes this check
|
||||
}
|
||||
|
||||
const checkPermission = (roleAccess: RoleAccess, permission: Permission, _userRoles?: string[]): boolean => {
|
||||
const roles = authStore.userRole
|
||||
return roles.some((role: string) => roleAccess[role]?.includes(permission) || role === 'system') // system by-passes this check
|
||||
return roles.some((role: string) => role === 'system' || roleAccess[role]?.includes(permission)) // system by-passes this check
|
||||
}
|
||||
|
||||
const getUserPermissions = (roleAccess: RoleAccess, _userRoles?: string[]): Permission[] => {
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
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[]>> = {
|
||||
'/chemo/verification': {
|
||||
'emp|reg': ['R'],
|
||||
'emp|doc': ['R'],
|
||||
'emp|nur': ['R'],
|
||||
},
|
||||
'/chemo/verification/[id]': {
|
||||
'emp|reg': ['R'],
|
||||
'emp|doc': ['R'],
|
||||
'emp|nur': ['R'],
|
||||
},
|
||||
'/chemo/verification/[id]/process': {
|
||||
'emp|doc': ['R', 'U'],
|
||||
'emp|nur': ['R', 'U'],
|
||||
},
|
||||
'/chemo/action': {
|
||||
'emp|reg': ['R', 'U', 'D'],
|
||||
},
|
||||
'/chemo/action/[id]': {
|
||||
'emp|reg': ['R', 'U', 'D'],
|
||||
},
|
||||
'/chemo/action/[id]/process': {
|
||||
'emp|doc': ['R', 'U'],
|
||||
'emp|nur': ['R', 'U'],
|
||||
'emp|thr': ['R', 'U'],
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
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[]>> = {
|
||||
'/emergency/triage': {
|
||||
'emp|doc': ['C', 'R', 'U', 'D'],
|
||||
'emp|nur': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/emergency/triage/add': {
|
||||
'emp|doc': ['C', 'R', 'U', 'D'],
|
||||
'emp|nur': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/emergency/triage/[id]': {
|
||||
'emp|doc': ['C', 'R', 'U', 'D'],
|
||||
'emp|nur': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/emergency/triage/[id]/edit': {
|
||||
'emp|doc': ['C', 'R', 'U', 'D'],
|
||||
'emp|nur': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/emergency/encounter': {
|
||||
'emp|reg': ['C', 'R', 'U', 'D'],
|
||||
'emp|doc': ['R'],
|
||||
'emp|nur': ['R'],
|
||||
'emp|thr': ['R'],
|
||||
'emp|miw': ['R'],
|
||||
'emp|nut': ['R'],
|
||||
'emp|pha': ['R'],
|
||||
'emp|lab': ['R'],
|
||||
'emp|rad': ['R'],
|
||||
},
|
||||
'/emergency/encounter/add': {
|
||||
'emp|reg': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/emergency/encounter/[id]': {
|
||||
'emp|reg': ['C', 'R', 'U', 'D'],
|
||||
'emp|doc': ['R'],
|
||||
'emp|nur': ['R'],
|
||||
'emp|thr': ['R'],
|
||||
'emp|miw': ['R'],
|
||||
'emp|nut': ['R'],
|
||||
'emp|pha': ['R'],
|
||||
'emp|lab': ['R'],
|
||||
'emp|rad': ['R'],
|
||||
},
|
||||
'/emergency/encounter/[id]/edit': {
|
||||
'emp|reg': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/emergency/encounter/[id]/process': {
|
||||
'emp|doc': ['R', 'U'],
|
||||
'emp|nur': ['R', 'U'],
|
||||
'emp|thr': ['R', 'U'],
|
||||
'emp|miw': ['R', 'U'],
|
||||
'emp|nut': ['R', 'U'],
|
||||
'emp|pha': ['R', 'U'],
|
||||
'emp|lab': ['R', 'U'],
|
||||
'emp|rad': ['R', 'U'],
|
||||
},
|
||||
'/emergency/consulation': {
|
||||
'emp|doc': ['R'],
|
||||
},
|
||||
'/emergency/consulation/[id]/process': {
|
||||
'emp|doc': ['R', 'U'],
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
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[]>> = {
|
||||
'/human-src/employee': {
|
||||
'div|hrd': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/human-src/employee/add': {
|
||||
'div|hrd': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/human-src/employee/[id]/edit': {
|
||||
'div|hrd': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/human-src/intern': {
|
||||
'div|hrd': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/human-src/intern/add': {
|
||||
'div|hrd': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/human-src/intern/[id]/edit': {
|
||||
'div|hrd': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
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[]>> = {
|
||||
'/inpatient/request': {
|
||||
'emp|reg': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/inpatient/request/[id]/detail': {
|
||||
'emp|reg': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/inpatient/encounter': {
|
||||
'emp|reg': ['C', 'R', 'U', 'D'],
|
||||
'emp|doc': ['R'],
|
||||
'emp|nur': ['R'],
|
||||
'emp|thr': ['R'],
|
||||
'emp|miw': ['R'],
|
||||
'emp|nut': ['R'],
|
||||
'emp|pha': ['R'],
|
||||
'emp|lab': ['R'],
|
||||
'emp|rad': ['R'],
|
||||
},
|
||||
'/inpatient/encounter/add': {
|
||||
'emp|reg': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/inpatient/encounter/[id]': {
|
||||
'emp|reg': ['C', 'R', 'U', 'D'],
|
||||
'emp|doc': ['R'],
|
||||
'emp|nur': ['R'],
|
||||
'emp|thr': ['R'],
|
||||
'emp|miw': ['R'],
|
||||
'emp|nut': ['R'],
|
||||
'emp|pha': ['R'],
|
||||
'emp|lab': ['R'],
|
||||
'emp|rad': ['R'],
|
||||
},
|
||||
'/inpatient/encounter/[id]/edit': {
|
||||
'emp|reg': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/inpatient/encounter/[id]/process': {
|
||||
'emp|doc': ['R', 'U'],
|
||||
'emp|nur': ['R', 'U'],
|
||||
'emp|thr': ['R', 'U'],
|
||||
'emp|miw': ['R', 'U'],
|
||||
'emp|nut': ['R', 'U'],
|
||||
'emp|pha': ['R', 'U'],
|
||||
'emp|lab': ['R', 'U'],
|
||||
'emp|rad': ['R', 'U'],
|
||||
},
|
||||
'/inpatient/consulation': {
|
||||
'emp|doc': ['R'],
|
||||
},
|
||||
'/inpatient/consulation/[id]/process': {
|
||||
'emp|doc': ['R', 'U'],
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
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[]>> = {
|
||||
'/muc-src/checkup': {
|
||||
'emp|lab': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/muc-src/checkup-category': {
|
||||
'emp|lab': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/mcu-src/antibiotic-src': {
|
||||
'emp|lab': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/mcu-src/antibiotic-src-category': {
|
||||
'emp|lab': ['C', 'R', 'U', 'D'],
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
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[]>> = {
|
||||
'/infra-src/bed': {
|
||||
'div|fin': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/infra-src/chamber': {
|
||||
'div|fin': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/infra-src/room': {
|
||||
'div|fin': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/infra-src/warehouse': {
|
||||
'div|fin': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/infra-src/building': {
|
||||
'div|fin': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/infra-src/floor': {
|
||||
'div|fin': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/infra-src/counter': {
|
||||
'div|fin': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/infra-src/public-screen': {
|
||||
'div|fin': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
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[]>> = {
|
||||
'/outpatient/registration-queue': {
|
||||
'emp|reg': ['R', 'U', 'D'],
|
||||
},
|
||||
'/outpatient/encounter-queue': {
|
||||
'emp|nur': ['R', 'U', 'D'],
|
||||
},
|
||||
'/outpatient/encounter': {
|
||||
'emp|reg': ['C', 'R', 'U', 'D'],
|
||||
'emp|doc': ['R'],
|
||||
'emp|nur': ['R'],
|
||||
'emp|thr': ['R'],
|
||||
'emp|miw': ['R'],
|
||||
'emp|nut': ['R'],
|
||||
'emp|pha': ['R'],
|
||||
'emp|lab': ['R'],
|
||||
'emp|rad': ['R'],
|
||||
},
|
||||
'/outpatient/encounter/add': {
|
||||
'emp|reg': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/outpatient/encounter/[id]/detail': {
|
||||
'emp|reg': ['C', 'R', 'U', 'D'],
|
||||
'emp|doc': ['R'],
|
||||
'emp|nur': ['R'],
|
||||
'emp|thr': ['R'],
|
||||
'emp|miw': ['R'],
|
||||
'emp|nut': ['R'],
|
||||
'emp|pha': ['R'],
|
||||
'emp|lab': ['R'],
|
||||
'emp|rad': ['R'],
|
||||
},
|
||||
'/outpatient/encounter/[id]/edit': {
|
||||
'emp|reg': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/outpatient/encounter/[id]/process': {
|
||||
'emp|doc': ['R', 'U'],
|
||||
'emp|nur': ['R', 'U'],
|
||||
'emp|thr': ['R', 'U'],
|
||||
'emp|miw': ['R', 'U'],
|
||||
'emp|nut': ['R', 'U'],
|
||||
'emp|pha': ['R', 'U'],
|
||||
'emp|lab': ['R', 'U'],
|
||||
'emp|rad': ['R', 'U'],
|
||||
},
|
||||
'/outpatient/consulation': {
|
||||
'emp|doc': ['R'],
|
||||
},
|
||||
'/outpatient/consulation/[id]/process': {
|
||||
'emp|doc': ['R', 'U'],
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
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[]>> = {
|
||||
'/tools-equipment-src/medicine': {
|
||||
'div|fin': ['C', 'R', 'U', 'D'],
|
||||
'emp|pha': ['R'],
|
||||
},
|
||||
'/tools-equipment-src/medicine-method': {
|
||||
'div|fin': ['C', 'R', 'U', 'D'],
|
||||
'emp|pha': ['R'],
|
||||
},
|
||||
'/tools-equipment-src/medicine-type': {
|
||||
'div|fin': ['C', 'R', 'U', 'D'],
|
||||
'emp|pha': ['R'],
|
||||
},
|
||||
'/tools-equipment-src/medicine-form': {
|
||||
'div|fin': ['C', 'R', 'U', 'D'],
|
||||
'emp|pha': ['R'],
|
||||
},
|
||||
'/tools-equipment-src/device-src': {
|
||||
'div|fin': ['C', 'R', 'U', 'D'],
|
||||
'emp|pha': ['R'],
|
||||
},
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { RoleAccess } from '~/models/role'
|
||||
|
||||
export const PAGE_PERMISSIONS = {
|
||||
'/patient': {
|
||||
'/client/patient': {
|
||||
'emp|doc': ['R'],
|
||||
'emp|nur': ['R'],
|
||||
'emp|reg': ['C', 'R', 'U', 'D'],
|
||||
@@ -9,13 +9,11 @@ export const PAGE_PERMISSIONS = {
|
||||
'emp|pay': ['R'],
|
||||
'emp|mng': ['R'],
|
||||
},
|
||||
'/doctor': {
|
||||
'emp|doc': ['C', 'R', 'U', 'D'],
|
||||
'emp|nur': ['R'],
|
||||
'emp|reg': ['R'],
|
||||
'emp|pha': ['R'],
|
||||
'emp|pay': ['R'],
|
||||
'emp|mng': ['R'],
|
||||
'/human-src/employee': {
|
||||
'div|hrd': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/human-src/intern': {
|
||||
'div|hrd': ['C', 'R', 'U', 'D'],
|
||||
},
|
||||
'/satusehat': {
|
||||
'emp|doc': ['R'],
|
||||
|
||||
Reference in New Issue
Block a user