From 5f20de9a387d949143a90c03f9b545cd742ba3ba Mon Sep 17 00:00:00 2001 From: Kian Parvin Date: Wed, 23 Aug 2023 16:45:50 +0200 Subject: [PATCH] Renamed to internal package tag --- internal/openfga/openfga.go | 6 +++--- internal/openfga/openfga_test.go | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/openfga/openfga.go b/internal/openfga/openfga.go index c96560f4c..3c928ab8d 100644 --- a/internal/openfga/openfga.go +++ b/internal/openfga/openfga.go @@ -80,7 +80,7 @@ func (o *OFGAClient) getRelatedObjects(ctx context.Context, tuple Tuple, pageSiz // must NOT include the ID, i.e., // // - "group:" vs "group:mygroup", where "mygroup" is the ID and the correct objType would be "group". -func (o *OFGAClient) listObjects(ctx context.Context, user string, relation string, objType string, contextualTuples []Tuple) (objectIds []cofga.Entity, err error) { +func (o *OFGAClient) listObjects(ctx context.Context, user string, relation string, objType string, contextualTuples []Tuple) (objectIds []Tag, err error) { userEntity, err := cofga.ParseEntity(user) if err != nil { return nil, err @@ -88,7 +88,7 @@ func (o *OFGAClient) listObjects(ctx context.Context, user string, relation stri entities, err := o.cofgaClient.FindAccessibleObjectsByRelation(ctx, Tuple{ Object: &userEntity, Relation: cofga.Relation(relation), - Target: &cofga.Entity{Kind: cofga.Kind(objType)}, + Target: &Tag{Kind: cofga.Kind(objType)}, }, contextualTuples...) if err != nil { return nil, err @@ -107,7 +107,7 @@ func (o *OFGAClient) RemoveRelation(ctx context.Context, tuples ...Tuple) error } // ListObjects returns all object IDs of that a user has the relation to. -func (o *OFGAClient) ListObjects(ctx context.Context, user string, relation string, objType string, contextualTuples []Tuple) ([]cofga.Entity, error) { +func (o *OFGAClient) ListObjects(ctx context.Context, user string, relation string, objType string, contextualTuples []Tuple) ([]Tag, error) { return o.listObjects(ctx, user, relation, objType, contextualTuples) } diff --git a/internal/openfga/openfga_test.go b/internal/openfga/openfga_test.go index 8da2cb73d..443b6c26b 100644 --- a/internal/openfga/openfga_test.go +++ b/internal/openfga/openfga_test.go @@ -435,9 +435,9 @@ func (s *openFGATestSuite) TestListObjectsWithContextualTuples(c *gc.C) { "30000000-0000-0000-0000-000000000000", } - expected := make([]cofga.Entity, len(modelUUIDs)) + expected := make([]openfga.Tag, len(modelUUIDs)) for i, v := range modelUUIDs { - expected[i] = cofga.Entity{ + expected[i] = openfga.Tag{ Kind: "model", ID: v, } @@ -477,7 +477,7 @@ func (s *openFGATestSuite) TestListObjectsWithContextualTuples(c *gc.C) { c.Assert(cmp.Equal( ids, expected, - cmpopts.SortSlices(func(want cofga.Entity, expected cofga.Entity) bool { + cmpopts.SortSlices(func(want openfga.Tag, expected openfga.Tag) bool { return want.ID < expected.ID }), ), gc.Equals, true) @@ -492,9 +492,9 @@ func (s *openFGATestSuite) TestListObjectsWithPeristedTuples(c *gc.C) { "30000000-0000-0000-0000-000000000000", } - expected := make([]cofga.Entity, len(modelUUIDs)) + expected := make([]openfga.Tag, len(modelUUIDs)) for i, v := range modelUUIDs { - expected[i] = cofga.Entity{ + expected[i] = openfga.Tag{ Kind: "model", ID: v, } @@ -537,7 +537,7 @@ func (s *openFGATestSuite) TestListObjectsWithPeristedTuples(c *gc.C) { c.Assert(cmp.Equal( ids, expected, - cmpopts.SortSlices(func(want cofga.Entity, expected cofga.Entity) bool { + cmpopts.SortSlices(func(want openfga.Tag, expected openfga.Tag) bool { return want.ID < expected.ID }), ), gc.Equals, true)