Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change batch Authorize() to take an EntityGetter in place of an EntityMap #75

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ type String = types.String

// Other Cedar types

type EntityMap = types.EntityMap
type Entity = types.Entity
type EntityMap = types.EntityMap
type EntityType = types.EntityType
type EntityUIDSet = types.EntityUIDSet
type Pattern = types.Pattern
type Wildcard = types.Wildcard

// cedar-go types

type EntityGetter = types.EntityGetter
type Value = types.Value

// ____ _ _
Expand Down
2 changes: 1 addition & 1 deletion x/exp/batch/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ var errInvalidPart = fmt.Errorf("invalid part")
// - It will error in case of a callback error.
//
// The result passed to the callback must be used / cloned immediately and not modified.
func Authorize(ctx context.Context, ps *cedar.PolicySet, entities types.EntityMap, request Request, cb Callback) error {
func Authorize(ctx context.Context, ps *cedar.PolicySet, entities types.EntityGetter, request Request, cb Callback) error {
be := &batchEvaler{}
var found mapset.MapSet[types.String]
findVariables(&found, request.Principal)
Expand Down
2 changes: 1 addition & 1 deletion x/exp/batch/batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestBatch(t *testing.T) {
tests := []struct {
name string
policy *ast.Policy
entities types.EntityMap
entities types.EntityGetter
request Request
results []Result
}{
Expand Down
Loading