Skip to content

Commit

Permalink
fix(#210): allowed value simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
fredmaggiowski committed Jun 28, 2023
1 parent 4c0d6fd commit 70fe1a9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/opaevaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func (evaluator *OPAEvaluator) Evaluate(logger *logrus.Entry) (interface{}, erro
"evaluationTimeMicroseconds": opaEvaluationTime.Microseconds(),
"policyName": evaluator.PolicyName,
"partialEval": false,
"allowed": results.Allowed(),
"allowed": len(results) == 1 && len(results[0].Expressions) == 1,
"resultsLength": len(results),
"matchedPath": evaluator.routerInfo.MatchedPath,
"requestedPath": evaluator.routerInfo.RequestedPath,
Expand Down
2 changes: 1 addition & 1 deletion core/sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ func TestEvaluateResponsePolicy(t *testing.T) {
require.NotNil(t, actual)
delete(actual.Data, "evaluationTimeMicroseconds")
require.Equal(t, logrus.Fields{
"allowed": false,
"allowed": true,
"requestedPath": testCase.path,
"matchedPath": evaluatorInfo.evaluatorOptions.RouterInfo.MatchedPath,
"method": testCase.method,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/mia-platform/glogger/v2 v2.1.3
github.com/open-policy-agent/opa v0.53.1
github.com/prometheus/client_golang v1.16.0
github.com/prometheus/common v0.42.0
github.com/samber/lo v1.38.1
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
Expand Down Expand Up @@ -57,7 +58,6 @@ require (
github.com/perimeterx/marshmallow v1.1.4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/spf13/afero v1.9.2 // indirect
Expand Down

0 comments on commit 70fe1a9

Please sign in to comment.