@@ -200,27 +200,22 @@ func (api *API) scimPostUser(rw http.ResponseWriter, r *http.Request) {
200
200
sUser .UserName = httpapi .UsernameFrom (sUser .UserName )
201
201
}
202
202
203
- var organizationID uuid.UUID
203
+ // TODO: This is a temporary solution that does not support multi-org
204
+ // deployments. This assumption places all new SCIM users into the
205
+ // default organization.
204
206
//nolint:gocritic
205
- organizations , err := api .Database .GetOrganizations (dbauthz .AsSystemRestricted (ctx ))
207
+ defaultOrganization , err := api .Database .GetDefaultOrganization (dbauthz .AsSystemRestricted (ctx ))
206
208
if err != nil {
207
209
_ = handlerutil .WriteError (rw , err )
208
210
return
209
211
}
210
212
211
- if len (organizations ) > 0 {
212
- // Add the user to the first organization. Once multi-organization
213
- // support is added, we should enable a configuration map of user
214
- // email to organization.
215
- organizationID = organizations [0 ].ID
216
- }
217
-
218
213
//nolint:gocritic // needed for SCIM
219
214
dbUser , _ , err = api .AGPL .CreateUser (dbauthz .AsSystemRestricted (ctx ), api .Database , agpl.CreateUserRequest {
220
215
CreateUserRequest : codersdk.CreateUserRequest {
221
216
Username : sUser .UserName ,
222
217
Email : email ,
223
- OrganizationID : organizationID ,
218
+ OrganizationID : defaultOrganization . ID ,
224
219
},
225
220
LoginType : database .LoginTypeOIDC ,
226
221
})
0 commit comments