MCPcopy Index your code
hub / github.com/coder/coder / CreateFirstUser

Method CreateFirstUser

codersdk/users.go:527–538  ·  view source on GitHub ↗

CreateFirstUser attempts to create the first user on a Coder deployment. This initial user has superadmin privileges. If >0 users exist, this request will fail.

(ctx context.Context, req CreateFirstUserRequest)

Source from the content-addressed store, hash-verified

525// CreateFirstUser attempts to create the first user on a Coder deployment.
526// This initial user has superadmin privileges. If >0 users exist, this request will fail.
527func (c *Client) CreateFirstUser(ctx context.Context, req CreateFirstUserRequest) (CreateFirstUserResponse, error) {
528 res, err := c.Request(ctx, http.MethodPost, "/api/v2/users/first", req)
529 if err != nil {
530 return CreateFirstUserResponse{}, err
531 }
532 defer res.Body.Close()
533 if res.StatusCode != http.StatusCreated {
534 return CreateFirstUserResponse{}, ReadBodyAsError(res)
535 }
536 var resp CreateFirstUserResponse
537 return resp, json.NewDecoder(res.Body).Decode(&resp)
538}
539
540// CreateUser
541// Deprecated: Use CreateUserWithOrgs instead. This will be removed.

Callers 11

TestServerFunction · 0.95
TestSessionCookieMaxAgeFunction · 0.80
TestUserOIDCFunction · 0.80
TestFirstUserFunction · 0.80
TestPostLoginFunction · 0.80
CreateFirstUserFunction · 0.80
TestServer_ProductionFunction · 0.80
loginMethod · 0.80
TestResetPasswordFunction · 0.80
setupFirstUserFunction · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 8

TestServerFunction · 0.76
TestSessionCookieMaxAgeFunction · 0.64
TestUserOIDCFunction · 0.64
TestFirstUserFunction · 0.64
TestPostLoginFunction · 0.64
TestServer_ProductionFunction · 0.64
TestResetPasswordFunction · 0.64