@@ -201,8 +201,7 @@ func (api *API) postFirstUser(rw http.ResponseWriter, r *http.Request) {
201
201
Password : createUser .Password ,
202
202
OrganizationID : defaultOrg .ID ,
203
203
},
204
- CreateOrganization : false ,
205
- LoginType : database .LoginTypePassword ,
204
+ LoginType : database .LoginTypePassword ,
206
205
})
207
206
if err != nil {
208
207
httpapi .Write (ctx , rw , http .StatusInternalServerError , codersdk.Response {
@@ -1231,8 +1230,7 @@ func (api *API) organizationByUserAndName(rw http.ResponseWriter, r *http.Reques
1231
1230
1232
1231
type CreateUserRequest struct {
1233
1232
codersdk.CreateUserRequest
1234
- CreateOrganization bool
1235
- LoginType database.LoginType
1233
+ LoginType database.LoginType
1236
1234
}
1237
1235
1238
1236
func (api * API ) CreateUser (ctx context.Context , store database.Store , req CreateUserRequest ) (database.User , uuid.UUID , error ) {
@@ -1245,32 +1243,9 @@ func (api *API) CreateUser(ctx context.Context, store database.Store, req Create
1245
1243
var user database.User
1246
1244
return user , req .OrganizationID , store .InTx (func (tx database.Store ) error {
1247
1245
orgRoles := make ([]string , 0 )
1248
- // If no organization is provided, create a new one for the user.
1246
+ // Organization is required to know where to allocate the user.
1249
1247
if req .OrganizationID == uuid .Nil {
1250
- if ! req .CreateOrganization {
1251
- return xerrors .Errorf ("organization ID must be provided" )
1252
- }
1253
-
1254
- organization , err := tx .InsertOrganization (ctx , database.InsertOrganizationParams {
1255
- ID : uuid .New (),
1256
- Name : req .Username ,
1257
- CreatedAt : dbtime .Now (),
1258
- UpdatedAt : dbtime .Now (),
1259
- Description : "" ,
1260
- })
1261
- if err != nil {
1262
- return xerrors .Errorf ("create organization: %w" , err )
1263
- }
1264
- req .OrganizationID = organization .ID
1265
- // TODO: When organizations are allowed to be created, we should
1266
- // come back to determining the default role of the person who
1267
- // creates the org. Until that happens, all users in an organization
1268
- // should be just regular members. Membership role is implied, and
1269
- // not required to be explicit.
1270
- _ , err = tx .InsertAllUsersGroup (ctx , organization .ID )
1271
- if err != nil {
1272
- return xerrors .Errorf ("create %q group: %w" , database .EveryoneGroup , err )
1273
- }
1248
+ return xerrors .Errorf ("organization ID must be provided" )
1274
1249
}
1275
1250
1276
1251
params := database.InsertUserParams {
0 commit comments