Skip to content

Commit e18bc8f

Browse files
committed
PR comments
1 parent 02812e4 commit e18bc8f

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

coderd/coderd.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,6 @@ func New(options *Options) *API {
275275
options.Entitlements = entitlements.New()
276276
}
277277
if options.IDPSync == nil {
278-
// If this is set in the options, it is probably the enterprise
279-
// version of the code.
280278
options.IDPSync = idpsync.NewAGPLSync(options.Logger, idpsync.SyncSettings{
281279
OrganizationField: options.DeploymentValues.OIDC.OrganizationField.Value(),
282280
OrganizationMapping: options.DeploymentValues.OIDC.OrganizationMapping.Value,

coderd/idpsync/idpsync.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ type SyncSettings struct {
5252
OrganizationAssignDefault bool
5353
}
5454

55+
type OrganizationParams struct {
56+
// SyncEnabled if false will skip syncing the user's organizations.
57+
SyncEnabled bool
58+
// IncludeDefault is primarily for single org deployments. It will ensure
59+
// a user is always inserted into the default org.
60+
IncludeDefault bool
61+
// Organizations is the list of organizations the user should be a member of
62+
// assuming syncing is turned on.
63+
Organizations []uuid.UUID
64+
}
65+
66+
5567
func NewAGPLSync(logger slog.Logger, settings SyncSettings) *AGPLIDPSync {
5668
return &AGPLIDPSync{
5769
Logger: logger.Named("idp-sync"),

coderd/idpsync/organization.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,6 @@ func (s AGPLIDPSync) ParseOrganizationClaims(_ context.Context, _ jwt.MapClaims)
3030
}, nil
3131
}
3232

33-
type OrganizationParams struct {
34-
// SyncEnabled if false will skip syncing the user's organizations.
35-
SyncEnabled bool
36-
// IncludeDefault is primarily for single org deployments. It will ensure
37-
// a user is always inserted into the default org.
38-
IncludeDefault bool
39-
// Organizations is the list of organizations the user should be a member of
40-
// assuming syncing is turned on.
41-
Organizations []uuid.UUID
42-
}
43-
4433
// SyncOrganizations if enabled will ensure the user is a member of the provided
4534
// organizations. It will add and remove their membership to match the expected set.
4635
func (s AGPLIDPSync) SyncOrganizations(ctx context.Context, tx database.Store, user database.User, params OrganizationParams) error {

enterprise/coderd/enidpsync/enidpsync.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import (
77
"github.com/coder/coder/v2/coderd/idpsync"
88
)
99

10+
// EnterpriseIDPSync enabled syncing user information from an external IDP.
11+
// The sync is an enterprise feature, so this struct wraps the AGPL implementation
12+
// and extends it with enterprise capabilities. These capabilities can entirely
13+
// be changed in the Parsing, and leaving the "syncing" part (which holds the
14+
// more complex logic) to the shared AGPL implementation.
1015
type EnterpriseIDPSync struct {
1116
entitlements *entitlements.Set
1217
*idpsync.AGPLIDPSync

0 commit comments

Comments
 (0)