Skip to content

Commit

Permalink
Don't fetch each user for each group's grants. (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreer authored Jul 11, 2024
1 parent 91bd0b1 commit 2a0b902
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions pkg/connector/user-group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -143,7 +137,7 @@ func (ug *userGroupResourceType) Grants(ctx context.Context, resource *v2.Resour
grant.NewGrant(
resource,
memberEntitlement,
ur.Id,
rID,
),
)
}
Expand Down

0 comments on commit 2a0b902

Please sign in to comment.