@@ -523,8 +523,8 @@ func (s *Provider) GetGroupsMembersBruteForce(ctx context.Context, gr *model.Gro
523523 // brute force implemented here thanks to the fxxckin' aws sso scim api
524524 // iterate over each group and user and check if the user is a member of the group
525525 for _ , group := range gr .Resources {
526- // initialize the members slice for the group
527- membersByGroup [group .SCIMID ] = make ([]* model.Member , 0 )
526+ // initialize the members slice for the group. Optimistic approach
527+ membersByGroup [group .SCIMID ] = make ([]* model.Member , 0 , 10 )
528528
529529 for _ , user := range ur .Resources {
530530
@@ -545,7 +545,7 @@ func (s *Provider) GetGroupsMembersBruteForce(ctx context.Context, gr *model.Gro
545545 return fmt .Errorf ("scim: error listing groups: %w" , err )
546546 }
547547
548- slog .Debug ("checking group membership" , "group_name" , group .Name , "user_email" , user .Emails [0 ].Value , "results" , lgr .TotalResults )
548+ // slog.Debug("checking group membership", "group_name", group.Name, "user_email", user.Emails[0].Value, "results", lgr.TotalResults)
549549
550550 // AWS SSO SCIM API, it doesn't return the member into the Resources array
551551 if lgr .TotalResults > 0 {
@@ -555,9 +555,11 @@ func (s *Provider) GetGroupsMembersBruteForce(ctx context.Context, gr *model.Gro
555555 WithSCIMID (user .SCIMID ).
556556 WithEmail (user .Emails [0 ].Value ).
557557 Build ()
558+
558559 if user .Active {
559560 m .Status = "ACTIVE"
560561 }
562+
561563 mu .Lock ()
562564 membersByGroup [group .SCIMID ] = append (membersByGroup [group .SCIMID ], m )
563565 mu .Unlock ()
0 commit comments