@@ -217,22 +217,14 @@ func (api *API) scimPostUser(rw http.ResponseWriter, r *http.Request) {
217217sUser .UserName = codersdk .UsernameFrom (sUser .UserName )
218218}
219219
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-
230220//nolint:gocritic // needed for SCIM
231221dbUser ,err = api .AGPL .CreateUser (dbauthz .AsSystemRestricted (ctx ),api .Database , agpl.CreateUserRequest {
232222CreateUserRequestWithOrgs : 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 {},
236228},
237229LoginType :database .LoginTypeOIDC ,
238230// Do not send notifications to user admins as SCIM endpoint might be called sequentially to all users.