From 9edb4a7d87e1b7c0e8b3a8173122b68adc6673fa Mon Sep 17 00:00:00 2001 From: Geoff Greer Date: Wed, 14 Feb 2024 13:42:03 -0800 Subject: [PATCH] Fetch page access levels for a group once instead of re-fetching for every member of a group. --- pkg/connector/pages.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/connector/pages.go b/pkg/connector/pages.go index 234ead3a..a9699ba4 100644 --- a/pkg/connector/pages.go +++ b/pkg/connector/pages.go @@ -173,17 +173,17 @@ func (s *pageSyncer) Grants(ctx context.Context, resource *v2.Resource, pToken * return nil, "", nil, err } + pageAccessLevels, err := s.pageAccessLevelsForGroup(ctx, page, group) + if err != nil { + return nil, "", nil, err + } + for _, m := range members { if m.GetUserID() == 0 { l.Debug("member did not have user ID defined -- skipping") continue } - pageAccessLevels, err := s.pageAccessLevelsForGroup(ctx, page, group) - if err != nil { - return nil, "", nil, err - } - principalID := &v2.ResourceId{ ResourceType: resourceTypeUser.Id, Resource: formatObjectID(resourceTypeUser.Id, m.GetUserID()),