@@ -217,22 +217,14 @@ func (api *API) scimPostUser(rw http.ResponseWriter, r *http.Request) {
217
217
sUser .UserName = codersdk .UsernameFrom (sUser .UserName )
218
218
}
219
219
220
- // TODO: This is a temporary solution that does not support multi-org
221
- // deployments. This assumption places all new SCIM users into the
222
- //default organization.
223
- //nolint:gocritic
224
- defaultOrganization ,err := api .Database .GetDefaultOrganization (dbauthz .AsSystemRestricted (ctx ))
225
- if err != nil {
226
- _ = handlerutil .WriteError (rw ,err )
227
- return
228
- }
229
-
230
220
//nolint:gocritic // needed for SCIM
231
221
dbUser ,err = api .AGPL .CreateUser (dbauthz .AsSystemRestricted (ctx ),api .Database , agpl.CreateUserRequest {
232
222
CreateUserRequestWithOrgs : codersdk.CreateUserRequestWithOrgs {
233
- Username :sUser .UserName ,
234
- Email :email ,
235
- OrganizationIDs : []uuid.UUID {defaultOrganization .ID },
223
+ Username :sUser .UserName ,
224
+ Email :email ,
225
+ // In the multi-org world, SCIM does not assign any orgs. Users will
226
+ // be automatically sync'd with the correct organization on login.
227
+ OrganizationIDs : []uuid.UUID {},
236
228
},
237
229
LoginType :database .LoginTypeOIDC ,
238
230
// Do not send notifications to user admins as SCIM endpoint might be called sequentially to all users.