Method: Gitlab::Client::Users#create_user

Defined in:
lib/gitlab/client/users.rb

#create_user(*args) ⇒ Gitlab::ObjectifiedHash

Creates a new user. Requires authentication from an admin account.

Examples:

Gitlab.create_user('[email protected]', 'secret', 'joe', { name: 'Joe Smith' })
or
Gitlab.create_user('[email protected]', 'secret')

Parameters:

  • email (String)

    The email of a user.

  • password (String)

    The password of a user.

  • username (String)

    The username of a user.

  • options (Hash)

    A customizable set of options.

Returns:



50
51
52
53
54
55
56
57
58
59
# File 'lib/gitlab/client/users.rb', line 50

def create_user(*args)
  options = Hash === args.last ? args.pop : {}
  if args[2]
    body = { email: args[0], password: args[1], username: args[2] }
  else
    body = { email: args[0], password: args[1], name: args[0] }
  end
  body.merge!(options)
  post('/users', body: body)
end