Skip to content

Commit 45420b9

Browse files
authored
chore: allow removing users from the default org (coder#14699)
* chore: allow removing users from the default org Removed as no longer in experimental
1 parent ce21b20 commit 45420b9

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

coderd/members.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,6 @@ func (api *API) deleteOrganizationMember(rw http.ResponseWriter, r *http.Request
116116
aReq.Old = member.OrganizationMember.Auditable(member.Username)
117117
defer commitAudit()
118118

119-
if organization.IsDefault {
120-
// Multi-organizations is currently an experiment, which means it is feasible
121-
// for a deployment to enable, then disable this. To maintain backwards
122-
// compatibility, this safety is necessary.
123-
// TODO: Remove this check when multi-organizations is fully supported.
124-
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
125-
Message: "Removing members from the default organization is not supported.",
126-
Detail: "Multi-organizations is currently an experiment, and until it is fully supported, the default org should be protected.",
127-
Validations: nil,
128-
})
129-
return
130-
}
131-
132119
if member.UserID == apiKey.UserID {
133120
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{Message: "cannot remove self from an organization"})
134121
return

coderd/members_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestAddMember(t *testing.T) {
3333
func TestDeleteMember(t *testing.T) {
3434
t.Parallel()
3535

36-
t.Run("NotAllowed", func(t *testing.T) {
36+
t.Run("Allowed", func(t *testing.T) {
3737
t.Parallel()
3838
owner := coderdtest.New(t, nil)
3939
first := coderdtest.CreateFirstUser(t, owner)
@@ -45,7 +45,7 @@ func TestDeleteMember(t *testing.T) {
4545
// this test should be updated to check there is no error.
4646
// nolint:gocritic // must be an owner to see the user
4747
err := owner.DeleteOrganizationMember(ctx, first.OrganizationID, user.Username)
48-
require.ErrorContains(t, err, "Multi-organizations is currently an experiment")
48+
require.NoError(t, err)
4949
})
5050
}
5151

0 commit comments

Comments
 (0)