<<

# Bugzilla::Webservice::User

- NAME
- DESCRIPTION
- METHODS
  - Logging In and Out
  - Account Creation
  - User Info

# NAME

Bugzilla::Webservice::User - The User Account and Login API

# DESCRIPTION

This part of the Bugzilla API allows you to create User Accounts and log in/out using an existing account.

# METHODS

See Bugzilla::WebService for a description of how parameters are passed, and what STABLE, UNSTABLE, and EXPERIMENTAL mean.

## Logging In and Out

`login`

  STABLE

  Description

    Logging in, with a username and password, is required for many Bugzilla installations, in order to search for bugs, post new bugs, etc. This method logs in an user.

  Params
    `login` (string) - The user's login name.
    `password` (string) - The user's password.
    `remember` (bool) Optional - if the cookies returned by the call to login should expire with the session or not. In order for this option to have effect the Bugzilla server must be configured to allow the user to set this option - the Bugzilla parameter rememberlogin must be set to "defaulton" or "defaultoff". Addionally, the client application must implement management of cookies across sessions.
  Returns

    On success, a hash containing one item, `id`, the numeric id of the user that was logged in. A set of http cookies is also sent with the response. These cookies must be sent along with any future requests to the webservice, for the duration of the session.

  Errors
    300 (Invalid Username or Password)

      The username does not exist, or the password is wrong.

    301 (Account Disabled)

      The account has been disabled. A reason may be specified with the error.

    50 (Param Required)

      A login or password parameter was not provided.

`logout`

  STABLE

  Description

    Log out the user. Does nothing if there is no user logged in.

  Params (none)
  Returns (nothing)
  Errors (none)

## Account Creation

`offer_account_by_email`

  STABLE

  Description

    Sends an email to the user, offering to create an account. The user will have to click on a URL in the email, and choose their password and real name.

    This is the recommended way to create a Bugzilla account.

  Param
    `email` (string) - the email to send the offer to.
  Returns (nothing)
  Errors
    500 (Illegal Email Address)

      This Bugzilla does not allow you to create accounts with the format of email address you specified. Account creation may be entirely disabled.

    501 (Account Already Exists)

      An account with that email address already exists in Bugzilla.

`create`

  EXPERIMENTAL

  Description

    Creates a user account directly in Bugzilla, password and all. Instead of this, you should use "offer_account_by_email" when possible, because that makes sure that the email address specified can actually receive an email. This function does not check that.

    You must be logged in and have the `editusers` privilege in order to call this function.

  Params
    `email` (string) - The email address for the new user.
    `full_name` (string) Optional - The user's full name. Will be set to empty if not specified.
    `password` (string) Optional - The password for the new user account, in plain text. It will be stripped of leading and trailing whitespace. If blank or not specified, the newly created account will exist in Bugzilla, but will not be allowed to log in using DB authentication until a password is set either by the user (through resetting their password) or by the administrator.
  Returns

    A hash containing one item, `id`, the numeric id of the user that was created.

  Errors

    The same as "offer_account_by_email". If a password is specified, the function may also throw:

    502 (Password Too Short)

      The password specified is too short. (Usually, this means the password is under three characters.)

    503 (Password Too Long)

      The password specified is too long. (Usually, this means the password is over ten characters.)

## User Info

`get`

  UNSTABLE

  Description

    Gets information about user accounts in Bugzilla.

  Params

    Note: At least one of `ids`, `names`, or `match` must be specified.

    Note: Users will not be returned more than once, so even if a user is matched by more than one argument, only one user will be returned.

    `ids` (array)

      An array of integers, representing user ids.

      Logged-out users cannot pass this parameter to this function. If they try, they will get an error. Logged-in users will get an error if they specify the id of a user they cannot see.

    `names` (array) - An array of login names (strings).
    `match` (array)

      An array of strings. This works just like "user matching" in Bugzilla itself. Users will be returned whose real name or login name contains any one of the specified strings. Users that you cannot see will not be included in the returned list.

      Some Bugzilla installations have user-matching turned off, in which case you will only be returned exact matches.

      Most installations have a limit on how many matches are returned for each string, which defaults to 1000 but can be changed by the Bugzilla administrator.

      Logged-out users cannot use this argument, and an error will be thrown if they try. (This is to make it harder for spammers to harvest email addresses from Bugzilla, and also to enforce the user visibility restrictions that are implemented on some Bugzillas.)

    `include_fields` (array)

      An array of strings, representing the names of keys in the hashes this function returns. Only the fields specified in this hash will be returned, the rest will not be included.

      Essentially, this is a way to make the return value smaller, for performance or bandwidth reasons.

      If you specify an empty array, then this function will return empty hashes.

      Invalid field names are ignored.

    `exclude_fields` (array)

      An array of strings, representing the names of keys in the hashes this function returns. The fields specified will not be excluded from the returned hashes.

      Essentially, this is a way to exclude certain fields from the returned hashes, for performance or bandwidth reasons.

      If you specify all the fields, then this function will return empty hashes.

      Invalid field names are ignored.

      This overrides `include_fields`.

  Returns

    A hash containing one item, `users`, that is an array of hashes. Each hash describes a user, and has the following items:

    id

      `int` The unique integer ID that Bugzilla uses to represent this user. Even if the user's login name changes, this will not change.

    real_name

      `string` The actual name of the user. May be blank.

    email

      `string` The email address of the user.

    name

      `string` The login name of the user. Note that in some situations this is different than their email.

    can_login

      `boolean` A boolean value to indicate if the user can login into bugzilla.

    email_enabled

      `boolean` A boolean value to indicate if bug-related mail will be sent to the user or not.

    login_denied_text

      `string` A text field that holds the reason for disabling a user from logging into bugzilla, if empty then the user account is enabled. Otherwise it is disabled/closed.

      Note: If you are not logged in to Bugzilla when you call this function, you will only be returned the `id`, `name`, and `real_name` items. If you are logged in and not in editusers group, you will only be returned the `id`, `name`, `real_name`, `email`, and `can_login` items.

  Errors
    51 (Bad Login Name)

      You passed an invalid login name in the "names" array.

    304 (Authorization Required)

      You are logged in, but you are not authorized to see one of the users you wanted to get information about by user id.

    505 (User Access By Id or User-Matching Denied)

      Logged-out users cannot use the "ids" or "match" arguments to this function.

  History
    Added in Bugzilla 3.4.

<<