Skip to content

Commit 64aee46

Browse files
committed
🧹
1 parent 6a846cd commit 64aee46

File tree

10 files changed

+502
-38
lines changed

10 files changed

+502
-38
lines changed

coderd/apidoc/docs.go

Lines changed: 109 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 101 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/idpsync/group.go

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7-
"regexp"
87

98
"github.com/golang-jwt/jwt/v4"
109
"github.com/google/uuid"
@@ -15,7 +14,9 @@ import (
1514
"github.com/coder/coder/v2/coderd/database/db2sdk"
1615
"github.com/coder/coder/v2/coderd/database/dbauthz"
1716
"github.com/coder/coder/v2/coderd/runtimeconfig"
17+
"github.com/coder/coder/v2/coderd/util/ptr"
1818
"github.com/coder/coder/v2/coderd/util/slice"
19+
"github.com/coder/coder/v2/codersdk"
1920
)
2021

2122
type GroupParams struct {
@@ -94,12 +95,12 @@ func (s AGPLIDPSync) SyncGroups(ctx context.Context, db database.Store, user dat
9495

9596
// Legacy deployment settings will override empty settings.
9697
if orgID == defaultOrgID && settings.Field == "" {
97-
settings = &GroupSyncSettings{
98+
settings = ptr.Ref(GroupSyncSettings(codersdk.GroupSyncSettings{
9899
Field: s.Legacy.GroupField,
99100
LegacyNameMapping: s.Legacy.GroupMapping,
100101
RegexFilter: s.Legacy.GroupFilter,
101102
AutoCreateMissing: s.Legacy.CreateMissingGroups,
102-
}
103+
}))
103104
}
104105
orgSettings[orgID] = *settings
105106
}
@@ -243,27 +244,7 @@ func (s AGPLIDPSync) ApplyGroupDifference(ctx context.Context, tx database.Store
243244
return nil
244245
}
245246

246-
type GroupSyncSettings struct {
247-
// Field selects the claim field to be used as the created user's
248-
// groups. If the group field is the empty string, then no group updates
249-
// will ever come from the OIDC provider.
250-
Field string `json:"field"`
251-
// Mapping maps from an OIDC group --> Coder group ID
252-
Mapping map[string][]uuid.UUID `json:"mapping"`
253-
// RegexFilter is a regular expression that filters the groups returned by
254-
// the OIDC provider. Any group not matched by this regex will be ignored.
255-
// If the group filter is nil, then no group filtering will occur.
256-
RegexFilter *regexp.Regexp `json:"regex_filter"`
257-
// AutoCreateMissing controls whether groups returned by the OIDC provider
258-
// are automatically created in Coder if they are missing.
259-
AutoCreateMissing bool `json:"auto_create_missing_groups"`
260-
// LegacyNameMapping is deprecated. It remaps an IDP group name to
261-
// a Coder group name. Since configuration is now done at runtime,
262-
// group IDs are used to account for group renames.
263-
// For legacy configurations, this config option has to remain.
264-
// Deprecated: Use Mapping instead.
265-
LegacyNameMapping map[string]string `json:"legacy_group_name_mapping,omitempty"`
266-
}
247+
type GroupSyncSettings codersdk.GroupSyncSettings
267248

268249
func (s *GroupSyncSettings) Set(v string) error {
269250
return json.Unmarshal([]byte(v), s)

0 commit comments

Comments
 (0)