(ctx context.Context, orgID uuid.UUID, db database.Store)
| 41 | } |
| 42 | |
| 43 | func (s AGPLIDPSync) GroupSyncSettings(ctx context.Context, orgID uuid.UUID, db database.Store) (*GroupSyncSettings, error) { |
| 44 | orgResolver := s.Manager.OrganizationResolver(db, orgID) |
| 45 | settings, err := s.SyncSettings.Group.Resolve(ctx, orgResolver) |
| 46 | if err != nil { |
| 47 | if !xerrors.Is(err, runtimeconfig.ErrEntryNotFound) { |
| 48 | return nil, xerrors.Errorf("resolve group sync settings: %w", err) |
| 49 | } |
| 50 | |
| 51 | // Default to not being configured |
| 52 | settings = &GroupSyncSettings{} |
| 53 | |
| 54 | // Check for legacy settings if the default org. |
| 55 | if s.DeploymentSyncSettings.Legacy.GroupField != "" { |
| 56 | defaultOrganization, err := db.GetDefaultOrganization(ctx) |
| 57 | if err != nil { |
| 58 | return nil, xerrors.Errorf("get default organization: %w", err) |
| 59 | } |
| 60 | if defaultOrganization.ID == orgID { |
| 61 | settings = ptr.Ref(GroupSyncSettings(codersdk.GroupSyncSettings{ |
| 62 | Field: s.Legacy.GroupField, |
| 63 | LegacyNameMapping: s.Legacy.GroupMapping, |
| 64 | RegexFilter: s.Legacy.GroupFilter, |
| 65 | AutoCreateMissing: s.Legacy.CreateMissingGroups, |
| 66 | })) |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | return settings, nil |
| 72 | } |
| 73 | |
| 74 | func (s AGPLIDPSync) ParseGroupClaims(_ context.Context, mergedClaims jwt.MapClaims) (GroupParams, *HTTPError) { |
| 75 | if s.GroupField != "" && len(s.GroupAllowList) > 0 { |
no test coverage detected