Skip to content

Commit 41ac4d5

Browse files
committed
Fix: refresh account status
1 parent 157b6bf commit 41ac4d5

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

coderd/coderdtest/coderdtest.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,12 @@ func createAnotherUserRetry(t *testing.T, client *codersdk.Client, organizationI
581581
other.HTTPClient.CloseIdleConnections()
582582
})
583583

584+
if user.Status == codersdk.UserStatusDormant {
585+
// Refresh user account which should be active now.
586+
user, err = other.User(context.Background(), user.Username)
587+
require.NoError(t, err)
588+
}
589+
584590
if len(roles) > 0 {
585591
// Find the roles for the org vs the site wide roles
586592
orgRoles := make(map[string][]string)

coderd/users.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ func (api *API) putSuspendUserAccount() func(rw http.ResponseWriter, r *http.Req
631631
}
632632

633633
// @Summary Mark user account as dormant
634-
// @ID dormant-user-account
634+
// @ID mark-user-account-as-dormant
635635
// @Security CoderSessionToken
636636
// @Produce json
637637
// @Tags Users

enterprise/coderd/scim.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,9 @@ type SCIMUser struct {
110110
Type string `json:"type"`
111111
Display string `json:"display"`
112112
} `json:"emails"`
113-
Active bool `json:"active"`
114-
Dormant bool `json:"dormant"`
115-
Groups []interface{} `json:"groups"`
116-
Meta struct {
113+
Active bool `json:"active"`
114+
Groups []interface{} `json:"groups"`
115+
Meta struct {
117116
ResourceType string `json:"resourceType"`
118117
} `json:"meta"`
119118
}
@@ -265,8 +264,6 @@ func (api *API) scimPatchUser(rw http.ResponseWriter, r *http.Request) {
265264
var status database.UserStatus
266265
if sUser.Active {
267266
status = database.UserStatusActive
268-
} else if sUser.Dormant {
269-
status = database.UserStatusDormant
270267
} else {
271268
status = database.UserStatusSuspended
272269
}

0 commit comments

Comments
 (0)