module Sonarqube::Client::Users

Defines methods related to users. @see SONAR_URL/web_api/api/users

Public Instance Methods

change_password_user(login, password, old_password = nil, options = {}) click to toggle source

Change password the specified user. Available only for admin.

@example

Sonarqube.change_password_user('joe', 'password')
Sonarqube.change_password_user('admin', 'password', admin)

@param [String] login (required) The login of a user @param [String] password (required) New password for login @param [String] old_password (optional) Previous password. Required when changing one's own password. @param [Hash] options A customizable set of options.

# File lib/sonarqube/client/users.rb, line 87
def change_password_user(login, password, old_password = nil, options = {})
  body = { login: login, password: password }
  body = { old_password: old_password }.merge!(body) unless old_password.nil?
  post('/api/users/change_password', body: body.merge!(options))
end
Also aliased as: user_change_password
create_user(login, name, password = nil, options = {}) click to toggle source

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

@example

Sonarqube.create_user('joe', 'joe', 'secret', , { mail: 'joe@foo.org' })
or
Sonarqube.create_user('joe', 'joe', 'secret')

@param [String] name (required) The name of a user. @param [String] login (required) The login of a user. @param [String] password (required only is local user) The password of a user. @param [Hash] options A customizable set of options. @option options [String] :email The emails of a user. @option options [String] :local Specify if the user should be authenticated from SonarQube server or from an external authentication system. Password should not be set when local is set to false. @option options [String] :scmAccount List of SCM accounts. To set several values, the parameter must be called once for each value. @param [Hash] options A customizable set of options. @return [Sonarqube::ObjectifiedHash] Information about created user.

# File lib/sonarqube/client/users.rb, line 41
def create_user(login, name, password = nil, options = {})
  body = { login: login, password: password, name: name }
  body.merge!(options)
  post('/api/users/create', body: body)
end
Also aliased as: user_create
deactivate_user(login, options = {}) click to toggle source

Blocks the specified user. Available only for admin.

@example

Sonarqube.deactivate_user('login')

@param [String] login (required) The login of a user @param [Hash] options A customizable set of options.

# File lib/sonarqube/client/users.rb, line 72
def deactivate_user(login, options = {})
  post('/api/users/deactivate', body: { login: login }.merge!(options))
end
Also aliased as: user_deactivate
groups_user(login, options = {}) click to toggle source

Lists the groups a user belongs to.

@example

Sonarqube.group_user('login')

@param [String] login A customizable set of options. @param [Hash] options A customizable set of options. @option options [Integer] :page The page number. @option options [Integer] :per_page The number of results per page. @option options [String] :from The start date for paginated results. @return [Array<Sonarqube::ObjectifiedHash>]

# File lib/sonarqube/client/users.rb, line 119
def groups_user(login, options = {})
  get('/api/users/groups', query: { login: login }.merge!(options))
end
Also aliased as: user_groups
search_users(options = {})
Alias for: users_search
update_login_user(login, new_login, options = {}) click to toggle source

Update login user.

@example

Sonarqube.update_login_user('test', 'new_test')

@param [String] login (required) The login of a user @param [String] new_login (required) The new login of a user @param [Hash] options A customizable set of options. @return [Sonarqube::ObjectifiedHash]

# File lib/sonarqube/client/users.rb, line 103
def update_login_user(login, new_login, options = {})
  post('/api/users/update_login', body: { login: login, newLogin: new_login }.merge!(options))
end
Also aliased as: user_update_login
update_user(login, options = {}) click to toggle source

Updates a user.

@example

Sonarqube.update_user('joe', { email: 'joe.smith@foo.org', name: 'Joe' })

@param [String] login (required) The login of a user @param [Hash] options A customizable set of options. @option options [String] :email The email of a user. @option options [String] :name The name of a user. @option options [String] :scmAccount SCM accounts. To set several values, the parameter must be called once for each value. @param [Hash] options A customizable set of options. @return [Sonarqube::ObjectifiedHash] Information about update user.

# File lib/sonarqube/client/users.rb, line 60
def update_user(login, options = {})
  post('/api/users/update', body: { login: login }.merge!(options))
end
Also aliased as: user_update
user_change_password(login, password, old_password = nil, options = {})
user_create(login, name, password = nil, options = {})
Alias for: create_user
user_deactivate(login, options = {})
Alias for: deactivate_user
user_groups(login, options = {})
Alias for: groups_user
user_update(login, options = {})
Alias for: update_user
user_update_login(login, new_login, options = {})
Alias for: update_login_user