Skip to content

Commit

Permalink
Add body parser middleware in the policy engine
Browse files Browse the repository at this point in the history
  • Loading branch information
samteb authored Feb 27, 2024
1 parent edb9ebe commit 1b48714
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions apps/policy-engine/src/app/__test__/unit/app.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ describe('finalizeDecision', () => {
reasons: [
{
policyId: 'forbid-rule-id',
policyName: 'Forbid Rule',
type: 'forbid',
approvalsMissing: [],
approvalsSatisfied: []
},
{
policyId: 'permit-rule-id',
policyName: 'Permit Rule',
type: 'permit',
approvalsMissing: [],
approvalsSatisfied: []
Expand All @@ -34,12 +36,14 @@ describe('finalizeDecision', () => {
reasons: [
{
policyId: 'permit-rule-id',
policyName: 'Permit Rule',
type: 'permit',
approvalsMissing: [],
approvalsSatisfied: []
},
{
policyId: 'permit-rule-id',
policyName: 'Permit Rule',
type: 'permit',
approvalsMissing: [],
approvalsSatisfied: []
Expand All @@ -58,6 +62,7 @@ describe('finalizeDecision', () => {
reasons: [
{
policyId: 'permit-rule-id',
policyName: 'Permit Rule',
type: 'permit',
approvalsMissing: [
{
Expand Down Expand Up @@ -111,6 +116,7 @@ describe('finalizeDecision', () => {
reasons: [
{
policyId: 'permit-rule-id',
policyName: 'Permit Rule',
type: 'permit',
approvalsMissing: [missingApproval],
approvalsSatisfied: [satisfiedApproval]
Expand All @@ -122,6 +128,7 @@ describe('finalizeDecision', () => {
reasons: [
{
policyId: 'permit-rule-id',
policyName: 'Permit Rule',
type: 'permit',
approvalsMissing: [missingApproval2],
approvalsSatisfied: [satisfiedApproval2]
Expand Down
2 changes: 1 addition & 1 deletion apps/policy-engine/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const withGlobalPipes = (app: INestApplication): INestApplication => {

async function bootstrap() {
const logger = new Logger('AuthorizationNodeBootstrap')
const application = await NestFactory.create(AppModule)
const application = await NestFactory.create(AppModule, { bodyParser: true })
const configService = application.get(ConfigService)
const port = configService.get('PORT')

Expand Down
1 change: 1 addition & 0 deletions apps/policy-engine/src/shared/types/domain.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type RegoInput = {
}

export type MatchedRule = {
policyName: string
policyId: string
type: 'permit' | 'forbid'
approvalsSatisfied: ApprovalRequirement[]
Expand Down
1 change: 1 addition & 0 deletions apps/policy-engine/src/shared/types/rego.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type RegoInput = {
}

type MatchedRule = {
policyName: string
policyId: string
type: 'permit' | 'forbid'
approvalsSatisfied: ApprovalRequirement[]
Expand Down

0 comments on commit 1b48714

Please sign in to comment.