Skip to content

Commit ea7b3f1

Browse files
committed
cleanup
1 parent 922e0e4 commit ea7b3f1

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

coderd/coderdtest/uuids_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func ExampleNewDeterministicUUIDGenerator() {
2626

2727
for _, tc := range testCases {
2828
tc := tc
29-
var _ = tc
29+
_ = tc
3030
// Do the test with CreateUsers as the setup, and the expected IDs
3131
// will match.
3232
}

coderd/database/dbauthz/dbauthz.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3109,7 +3109,11 @@ func (q *querier) RemoveUserFromAllGroups(ctx context.Context, userID uuid.UUID)
31093109
}
31103110

31113111
func (q *querier) RemoveUserFromGroups(ctx context.Context, arg database.RemoveUserFromGroupsParams) ([]uuid.UUID, error) {
3112-
panic("not implemented")
3112+
// This is a system function to clear user groups in group sync.
3113+
if err := q.authorizeContext(ctx, policy.ActionUpdate, rbac.ResourceSystem); err != nil {
3114+
return nil, err
3115+
}
3116+
return q.db.RemoveUserFromGroups(ctx, arg)
31133117
}
31143118

31153119
func (q *querier) RevokeDBCryptKey(ctx context.Context, activeKeyDigest string) error {

coderd/database/dbmem/dbmem.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7016,7 +7016,7 @@ func (q *FakeQuerier) InsertUser(_ context.Context, arg database.InsertUserParam
70167016
return user, nil
70177017
}
70187018

7019-
func (q *FakeQuerier) InsertUserGroupsByID(ctx context.Context, arg database.InsertUserGroupsByIDParams) ([]uuid.UUID, error) {
7019+
func (q *FakeQuerier) InsertUserGroupsByID(_ context.Context, arg database.InsertUserGroupsByIDParams) ([]uuid.UUID, error) {
70207020
err := validateDatabaseType(arg)
70217021
if err != nil {
70227022
return nil, err
@@ -7637,7 +7637,7 @@ func (q *FakeQuerier) RemoveUserFromAllGroups(_ context.Context, userID uuid.UUI
76377637
return nil
76387638
}
76397639

7640-
func (q *FakeQuerier) RemoveUserFromGroups(ctx context.Context, arg database.RemoveUserFromGroupsParams) ([]uuid.UUID, error) {
7640+
func (q *FakeQuerier) RemoveUserFromGroups(_ context.Context, arg database.RemoveUserFromGroupsParams) ([]uuid.UUID, error) {
76417641
err := validateDatabaseType(arg)
76427642
if err != nil {
76437643
return nil, err

coderd/idpsync/group.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (s AGPLIDPSync) SyncGroups(ctx context.Context, db database.Store, user dat
5454
// nolint:gocritic // all syncing is done as a system user
5555
ctx = dbauthz.AsSystemRestricted(ctx)
5656

57-
db.InTx(func(tx database.Store) error {
57+
err := db.InTx(func(tx database.Store) error {
5858
userGroups, err := tx.GetGroups(ctx, database.GetGroupsParams{
5959
HasMemberID: user.ID,
6060
})
@@ -188,6 +188,10 @@ func (s AGPLIDPSync) SyncGroups(ctx context.Context, db database.Store, user dat
188188
return nil
189189
}, nil)
190190

191+
if err != nil {
192+
return err
193+
}
194+
191195
return nil
192196
}
193197

@@ -208,13 +212,15 @@ type GroupSyncSettings struct {
208212
func (s *GroupSyncSettings) Set(v string) error {
209213
return json.Unmarshal([]byte(v), s)
210214
}
215+
211216
func (s *GroupSyncSettings) String() string {
212217
v, err := json.Marshal(s)
213218
if err != nil {
214219
return "decode failed: " + err.Error()
215220
}
216221
return string(v)
217222
}
223+
218224
func (s *GroupSyncSettings) Type() string {
219225
return "GroupSyncSettings"
220226
}

coderd/idpsync/idpsync.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ func FromDeploymentValues(dv *codersdk.DeploymentValues) DeploymentSyncSettings
100100
CreateMissingGroups: dv.OIDC.GroupAutoCreate.Value(),
101101
},
102102
}
103-
104103
}
105104

106105
type SyncSettings struct {

enterprise/coderd/enidpsync/groups_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestEnterpriseParseGroupClaims(t *testing.T) {
3030
t.Parallel()
3131

3232
s := enidpsync.NewSync(slogtest.Make(t, &slogtest.Options{}),
33-
runtimeconfig.NewNoopManager(),
33+
runtimeconfig.NewStoreManager(),
3434
entitlements.New(),
3535
idpsync.DeploymentSyncSettings{})
3636

@@ -46,7 +46,7 @@ func TestEnterpriseParseGroupClaims(t *testing.T) {
4646
t.Parallel()
4747

4848
s := enidpsync.NewSync(slogtest.Make(t, &slogtest.Options{}),
49-
runtimeconfig.NewNoopManager(),
49+
runtimeconfig.NewStoreManager(),
5050
entitled,
5151
idpsync.DeploymentSyncSettings{
5252
GroupField: "groups",
@@ -74,7 +74,7 @@ func TestEnterpriseParseGroupClaims(t *testing.T) {
7474
t.Parallel()
7575

7676
s := enidpsync.NewSync(slogtest.Make(t, &slogtest.Options{}),
77-
runtimeconfig.NewNoopManager(),
77+
runtimeconfig.NewStoreManager(),
7878
entitled,
7979
idpsync.DeploymentSyncSettings{
8080
GroupField: "groups",

0 commit comments

Comments
 (0)