Skip to content

Commit 71d82f7

Browse files
committed
cleanup comments
1 parent 46ed4a9 commit 71d82f7

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

coderd/idpsync/group.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ func (s AGPLIDPSync) ApplyGroupDifference(ctx context.Context, tx database.Store
206206
return xerrors.Errorf("remove user from %d groups: %w", len(removeIDs), err)
207207
}
208208
if len(removedGroupIDs) != len(removeIDs) {
209-
s.Logger.Debug(ctx, "failed to remove user from all groups",
209+
s.Logger.Debug(ctx, "user not removed from expected number of groups",
210210
slog.F("user_id", user.ID),
211211
slog.F("groups_removed_count", len(removedGroupIDs)),
212212
slog.F("expected_count", len(removeIDs)),
@@ -225,7 +225,7 @@ func (s AGPLIDPSync) ApplyGroupDifference(ctx context.Context, tx database.Store
225225
return xerrors.Errorf("insert user into %d groups: %w", len(add), err)
226226
}
227227
if len(assignedGroupIDs) != len(add) {
228-
s.Logger.Debug(ctx, "failed to assign all groups to user",
228+
s.Logger.Debug(ctx, "user not assigned to expected number of groups",
229229
slog.F("user_id", user.ID),
230230
slog.F("groups_assigned_count", len(assignedGroupIDs)),
231231
slog.F("expected_count", len(add)),
@@ -355,8 +355,7 @@ func (s GroupSyncSettings) ParseClaims(orgID uuid.UUID, mergedClaims jwt.MapClai
355355
// TODO: Batching this would be better, as this is 1 or 2 db calls per organization.
356356
func (s GroupSyncSettings) HandleMissingGroups(ctx context.Context, tx database.Store, orgID uuid.UUID, add []ExpectedGroup) ([]uuid.UUID, error) {
357357
// All expected that are missing IDs means the group does not exist
358-
// in the database. Either remove them, or create them if auto create is
359-
// turned on.
358+
// in the database, or it is a legacy mapping, and we need to do a lookup.
360359
var missingGroups []string
361360
addIDs := make([]uuid.UUID, 0)
362361

coderd/idpsync/idpsync.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ func FromDeploymentValues(dv *codersdk.DeploymentValues) DeploymentSyncSettings
9090
OrganizationMapping: dv.OIDC.OrganizationMapping.Value,
9191
OrganizationAssignDefault: dv.OIDC.OrganizationAssignDefault.Value(),
9292

93-
// TODO: Separate group field for allow list from default org
93+
// TODO: Separate group field for allow list from default org.
94+
// Right now you cannot disable group sync from the default org and
95+
// configure an allow list.
9496
GroupField: dv.OIDC.GroupField.Value(),
9597
GroupAllowList: ConvertAllowList(dv.OIDC.GroupAllowList.Value()),
9698
Legacy: DefaultOrgLegacySettings{

coderd/userauth.go

+2
Original file line numberDiff line numberDiff line change
@@ -1389,6 +1389,8 @@ func (api *API) oauthLogin(r *http.Request, params *oauthLoginParams) ([]*http.C
13891389
return xerrors.Errorf("sync organizations: %w", err)
13901390
}
13911391

1392+
// Group sync needs to occur after org sync, since a user can join an org,
1393+
// then have their groups sync to said org.
13921394
err = api.IDPSync.SyncGroups(ctx, tx, user, params.GroupSync)
13931395
if err != nil {
13941396
return xerrors.Errorf("sync groups: %w", err)

0 commit comments

Comments
 (0)