From 2a0b902ccdb1fdbebe9e94fa1c0d6942a83bc643 Mon Sep 17 00:00:00 2001 From: Geoff Greer Date: Thu, 11 Jul 2024 12:08:13 -0700 Subject: [PATCH] Don't fetch each user for each group's grants. (#24) --- pkg/connector/user-group.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pkg/connector/user-group.go b/pkg/connector/user-group.go index 11b3c62a..bb17d5ce 100644 --- a/pkg/connector/user-group.go +++ b/pkg/connector/user-group.go @@ -127,13 +127,7 @@ func (ug *userGroupResourceType) Grants(ctx context.Context, resource *v2.Resour // create membership grants var rv []*v2.Grant for _, id := range userIDs { - user, err := ug.client.GetUser(ctx, id) - if err != nil { - return nil, "", nil, err - } - - userCopy := user - ur, err := userResource(ctx, userCopy, resource.ParentResourceId) + rID, err := rs.NewResourceID(resourceTypeUser, id) if err != nil { return nil, "", nil, err } @@ -143,7 +137,7 @@ func (ug *userGroupResourceType) Grants(ctx context.Context, resource *v2.Resour grant.NewGrant( resource, memberEntitlement, - ur.Id, + rID, ), ) }