MCPcopy Index your code
hub / github.com/coder/coder / GroupSyncSettings

Method GroupSyncSettings

coderd/idpsync/group.go:43–72  ·  view source on GitHub ↗
(ctx context.Context, orgID uuid.UUID, db database.Store)

Source from the content-addressed store, hash-verified

41}
42
43func (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
74func (s AGPLIDPSync) ParseGroupClaims(_ context.Context, mergedClaims jwt.MapClaims) (GroupParams, *HTTPError) {
75 if s.GroupField != "" && len(s.GroupAllowList) > 0 {

Callers 1

SyncGroupsMethod · 0.95

Calls 7

RefFunction · 0.92
OrganizationResolverMethod · 0.80
GroupSyncSettingsTypeAlias · 0.70
ResolveMethod · 0.45
IsMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected