-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
1,187 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './module' | ||
export * from './role-factory' |
109 changes: 109 additions & 0 deletions
109
apps/hcdc-access-service/src/app/auth/role-factory/1-user.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import { EntityData, PermissionRule, Role } from '@diut/hcdc' | ||
|
||
export const userRoleFactory = (branchId: string) => | ||
({ | ||
branchId, | ||
displayIndex: 1, | ||
name: 'Người dùng', | ||
description: 'luôn chọn', | ||
permissions: [ | ||
{ | ||
subject: 'Branch', | ||
action: 'Read', | ||
conditions: { | ||
_id: branchId, | ||
}, | ||
} satisfies PermissionRule<'Branch'>, | ||
{ | ||
subject: 'User', | ||
action: 'Read', | ||
conditions: { | ||
branchIds: branchId, | ||
}, | ||
} satisfies PermissionRule<'User'>, | ||
{ | ||
subject: 'User', | ||
action: 'ChangePassword', | ||
conditions: { | ||
_id: '{{user._id}}', | ||
}, | ||
} satisfies PermissionRule<'User'>, | ||
{ | ||
subject: 'PrintForm', | ||
action: 'Read', | ||
conditions: { | ||
branchId: branchId, | ||
}, | ||
} satisfies PermissionRule<'PrintForm'>, | ||
{ | ||
subject: 'BioProduct', | ||
action: 'Read', | ||
conditions: { | ||
branchId: branchId, | ||
}, | ||
} satisfies PermissionRule<'BioProduct'>, | ||
{ | ||
subject: 'Instrument', | ||
action: 'Read', | ||
conditions: { | ||
branchId: branchId, | ||
}, | ||
} satisfies PermissionRule<'Instrument'>, | ||
{ | ||
subject: 'SampleType', | ||
action: 'Read', | ||
conditions: { | ||
branchId: branchId, | ||
}, | ||
} satisfies PermissionRule<'SampleType'>, | ||
{ | ||
subject: 'Doctor', | ||
action: 'Read', | ||
conditions: { | ||
branchId: branchId, | ||
}, | ||
} satisfies PermissionRule<'Doctor'>, | ||
{ | ||
subject: 'PatientType', | ||
action: 'Read', | ||
conditions: { | ||
branchId: branchId, | ||
}, | ||
} satisfies PermissionRule<'PatientType'>, | ||
{ | ||
subject: 'Diagnosis', | ||
action: 'Read', | ||
conditions: { | ||
branchId: branchId, | ||
}, | ||
} satisfies PermissionRule<'Diagnosis'>, | ||
{ | ||
subject: 'TestCategory', | ||
action: 'Read', | ||
conditions: { | ||
branchId: branchId, | ||
}, | ||
} satisfies PermissionRule<'TestCategory'>, | ||
{ | ||
subject: 'TestElement', | ||
action: 'Read', | ||
conditions: { | ||
branchId: branchId, | ||
}, | ||
} satisfies PermissionRule<'TestElement'>, | ||
{ | ||
subject: 'Test', | ||
action: 'Read', | ||
conditions: { | ||
branchId: branchId, | ||
}, | ||
} satisfies PermissionRule<'Test'>, | ||
{ | ||
subject: 'TestCombo', | ||
action: 'Read', | ||
conditions: { | ||
branchId: branchId, | ||
}, | ||
} satisfies PermissionRule<'TestCombo'>, | ||
], | ||
}) satisfies EntityData<Role> |
33 changes: 33 additions & 0 deletions
33
apps/hcdc-access-service/src/app/auth/role-factory/10-urine.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { EntityData, PermissionRule, ReportType, Role } from '@diut/hcdc' | ||
|
||
export const urineRoleFactory = (branchId: string) => | ||
({ | ||
branchId, | ||
displayIndex: 10, | ||
name: 'Sổ Urine', | ||
description: '', | ||
permissions: [ | ||
{ | ||
subject: 'Patient', | ||
action: 'Read', | ||
conditions: { | ||
branchId, | ||
}, | ||
} satisfies PermissionRule<'Patient'>, | ||
{ | ||
subject: 'Sample', | ||
action: 'Read', | ||
conditions: { | ||
branchId, | ||
}, | ||
} satisfies PermissionRule<'Sample'>, | ||
{ | ||
subject: 'Report', | ||
action: 'Export', | ||
conditions: { | ||
branchId, | ||
type: ReportType.Urine, | ||
}, | ||
} satisfies PermissionRule<'Report'>, | ||
], | ||
}) satisfies EntityData<Role> |
33 changes: 33 additions & 0 deletions
33
apps/hcdc-access-service/src/app/auth/role-factory/11-hcg.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { EntityData, PermissionRule, ReportType, Role } from '@diut/hcdc' | ||
|
||
export const hcgRoleFactory = (branchId: string) => | ||
({ | ||
branchId, | ||
displayIndex: 11, | ||
name: 'Sổ HCG', | ||
description: '', | ||
permissions: [ | ||
{ | ||
subject: 'Patient', | ||
action: 'Read', | ||
conditions: { | ||
branchId, | ||
}, | ||
} satisfies PermissionRule<'Patient'>, | ||
{ | ||
subject: 'Sample', | ||
action: 'Read', | ||
conditions: { | ||
branchId, | ||
}, | ||
} satisfies PermissionRule<'Sample'>, | ||
{ | ||
subject: 'Report', | ||
action: 'Export', | ||
conditions: { | ||
branchId, | ||
type: ReportType.HCG, | ||
}, | ||
} satisfies PermissionRule<'Report'>, | ||
], | ||
}) satisfies EntityData<Role> |
33 changes: 33 additions & 0 deletions
33
apps/hcdc-access-service/src/app/auth/role-factory/12-pap.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { EntityData, PermissionRule, ReportType, Role } from '@diut/hcdc' | ||
|
||
export const papRoleFactory = (branchId: string) => | ||
({ | ||
branchId, | ||
displayIndex: 12, | ||
name: 'Sổ Pap', | ||
description: '', | ||
permissions: [ | ||
{ | ||
subject: 'Patient', | ||
action: 'Read', | ||
conditions: { | ||
branchId, | ||
}, | ||
} satisfies PermissionRule<'Patient'>, | ||
{ | ||
subject: 'Sample', | ||
action: 'Read', | ||
conditions: { | ||
branchId, | ||
}, | ||
} satisfies PermissionRule<'Sample'>, | ||
{ | ||
subject: 'Report', | ||
action: 'Export', | ||
conditions: { | ||
branchId, | ||
type: ReportType.Pap, | ||
}, | ||
} satisfies PermissionRule<'Report'>, | ||
], | ||
}) satisfies EntityData<Role> |
33 changes: 33 additions & 0 deletions
33
apps/hcdc-access-service/src/app/auth/role-factory/13-thinprep.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { EntityData, PermissionRule, ReportType, Role } from '@diut/hcdc' | ||
|
||
export const thinprepRoleFactory = (branchId: string) => | ||
({ | ||
branchId, | ||
displayIndex: 13, | ||
name: 'Sổ Thinprep', | ||
description: '', | ||
permissions: [ | ||
{ | ||
subject: 'Patient', | ||
action: 'Read', | ||
conditions: { | ||
branchId, | ||
}, | ||
} satisfies PermissionRule<'Patient'>, | ||
{ | ||
subject: 'Sample', | ||
action: 'Read', | ||
conditions: { | ||
branchId, | ||
}, | ||
} satisfies PermissionRule<'Sample'>, | ||
{ | ||
subject: 'Report', | ||
action: 'Export', | ||
conditions: { | ||
branchId, | ||
type: ReportType.Thinprep, | ||
}, | ||
} satisfies PermissionRule<'Report'>, | ||
], | ||
}) satisfies EntityData<Role> |
33 changes: 33 additions & 0 deletions
33
apps/hcdc-access-service/src/app/auth/role-factory/14-hiv.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { EntityData, PermissionRule, ReportType, Role } from '@diut/hcdc' | ||
|
||
export const hivRoleFactory = (branchId: string) => | ||
({ | ||
branchId, | ||
displayIndex: 14, | ||
name: 'Sổ HIV', | ||
description: '', | ||
permissions: [ | ||
{ | ||
subject: 'Patient', | ||
action: 'Read', | ||
conditions: { | ||
branchId, | ||
}, | ||
} satisfies PermissionRule<'Patient'>, | ||
{ | ||
subject: 'Sample', | ||
action: 'Read', | ||
conditions: { | ||
branchId, | ||
}, | ||
} satisfies PermissionRule<'Sample'>, | ||
{ | ||
subject: 'Report', | ||
action: 'Export', | ||
conditions: { | ||
branchId, | ||
type: ReportType.HIV, | ||
}, | ||
} satisfies PermissionRule<'Report'>, | ||
], | ||
}) satisfies EntityData<Role> |
33 changes: 33 additions & 0 deletions
33
apps/hcdc-access-service/src/app/auth/role-factory/15-ctm.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { EntityData, PermissionRule, ReportType, Role } from '@diut/hcdc' | ||
|
||
export const ctmRoleFactory = (branchId: string) => | ||
({ | ||
branchId, | ||
displayIndex: 15, | ||
name: 'Sổ CTM', | ||
description: '', | ||
permissions: [ | ||
{ | ||
subject: 'Patient', | ||
action: 'Read', | ||
conditions: { | ||
branchId, | ||
}, | ||
} satisfies PermissionRule<'Patient'>, | ||
{ | ||
subject: 'Sample', | ||
action: 'Read', | ||
conditions: { | ||
branchId, | ||
}, | ||
} satisfies PermissionRule<'Sample'>, | ||
{ | ||
subject: 'Report', | ||
action: 'Export', | ||
conditions: { | ||
branchId, | ||
type: ReportType.CTM, | ||
}, | ||
} satisfies PermissionRule<'Report'>, | ||
], | ||
}) satisfies EntityData<Role> |
33 changes: 33 additions & 0 deletions
33
apps/hcdc-access-service/src/app/auth/role-factory/16-trakq.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { EntityData, PermissionRule, ReportType, Role } from '@diut/hcdc' | ||
|
||
export const trakqRoleFactory = (branchId: string) => | ||
({ | ||
branchId, | ||
displayIndex: 16, | ||
name: 'Sổ trả KQ', | ||
description: '', | ||
permissions: [ | ||
{ | ||
subject: 'Patient', | ||
action: 'Read', | ||
conditions: { | ||
branchId, | ||
}, | ||
} satisfies PermissionRule<'Patient'>, | ||
{ | ||
subject: 'Sample', | ||
action: 'Read', | ||
conditions: { | ||
branchId, | ||
}, | ||
} satisfies PermissionRule<'Sample'>, | ||
{ | ||
subject: 'Report', | ||
action: 'Export', | ||
conditions: { | ||
branchId, | ||
type: ReportType.TraKQ, | ||
}, | ||
} satisfies PermissionRule<'Report'>, | ||
], | ||
}) satisfies EntityData<Role> |
33 changes: 33 additions & 0 deletions
33
apps/hcdc-access-service/src/app/auth/role-factory/17-giaonhan.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { EntityData, PermissionRule, ReportType, Role } from '@diut/hcdc' | ||
|
||
export const giaonhanRoleFactory = (branchId: string) => | ||
({ | ||
branchId, | ||
displayIndex: 17, | ||
name: 'Sổ giao nhận', | ||
description: '', | ||
permissions: [ | ||
{ | ||
subject: 'Patient', | ||
action: 'Read', | ||
conditions: { | ||
branchId, | ||
}, | ||
} satisfies PermissionRule<'Patient'>, | ||
{ | ||
subject: 'Sample', | ||
action: 'Read', | ||
conditions: { | ||
branchId, | ||
}, | ||
} satisfies PermissionRule<'Sample'>, | ||
{ | ||
subject: 'Report', | ||
action: 'Export', | ||
conditions: { | ||
branchId, | ||
type: ReportType.GiaoNhan, | ||
}, | ||
} satisfies PermissionRule<'Report'>, | ||
], | ||
}) satisfies EntityData<Role> |
Oops, something went wrong.