<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> Bugzilla::User</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" title="style" type="text/css" href=".././../../../../style.css" media="all" > </head> <body id="pod"> <p class="backlinktop"><b><a name="___top" href="../index.html" accesskey="1" title="All Documents"><<</a></b></p> <h1>Bugzilla::User</h1> <div class='indexgroup'> <ul class='indexList indexList1'> <li class='indexItem indexItem1'><a href='#NAME'>NAME</a> <li class='indexItem indexItem1'><a href='#SYNOPSIS'>SYNOPSIS</a> <li class='indexItem indexItem1'><a href='#DESCRIPTION'>DESCRIPTION</a> <li class='indexItem indexItem1'><a href='#CONSTANTS'>CONSTANTS</a> <li class='indexItem indexItem1'><a href='#METHODS'>METHODS</a> <ul class='indexList indexList2'> <li class='indexItem indexItem2'><a href='#Constructors'>Constructors</a> <li class='indexItem indexItem2'><a href='#Saved_and_Shared_Queries'>Saved and Shared Queries</a> <li class='indexItem indexItem2'><a href='#Saved_Recent_Bug_Lists'>Saved Recent Bug Lists</a> <li class='indexItem indexItem2'><a href='#Account_Lockout'>Account Lockout</a> <li class='indexItem indexItem2'><a href='#Other_Methods'>Other Methods</a> </ul> <li class='indexItem indexItem1'><a href='#CLASS_FUNCTIONS'>CLASS FUNCTIONS</a> <li class='indexItem indexItem1'><a href='#SEE_ALSO'>SEE ALSO</a> <li class='indexItem indexItem1'><a href='#Methods_in_need_of_POD'>Methods in need of POD</a> </ul> </div> <h1><a class='u' href='#___top' title='click to go to top of document' name="NAME" >NAME</a></h1> <p>Bugzilla::User - Object for a Bugzilla user</p> <h1><a class='u' href='#___top' title='click to go to top of document' name="SYNOPSIS" >SYNOPSIS</a></h1> <pre class="code"> use Bugzilla::User; my $user = new Bugzilla::User($id); my @get_selectable_classifications = $user->get_selectable_classifications; # Class Functions $user = Bugzilla::User->create({ login_name => $username, realname => $realname, cryptpassword => $plaintext_password, disabledtext => $disabledtext, disable_mail => 0});</pre> <h1><a class='u' href='#___top' title='click to go to top of document' name="DESCRIPTION" >DESCRIPTION</a></h1> <p>This package handles Bugzilla users. Data obtained from here is read-only; there is currently no way to modify a user from this package.</p> <p>Note that the currently logged in user (if any) is available via <a href="../Bugzilla.html#user" class="podlinkpod" >Bugzilla->user</a>.</p> <p><code class="code">Bugzilla::User</code> is an implementation of <a href="../Bugzilla/Object.html" class="podlinkpod" >Bugzilla::Object</a>, and thus provides all the methods of <a href="../Bugzilla/Object.html" class="podlinkpod" >Bugzilla::Object</a> in addition to the methods listed below.</p> <h1><a class='u' href='#___top' title='click to go to top of document' name="CONSTANTS" >CONSTANTS</a></h1> <dl> <dt><a name="USER_MATCH_MULTIPLE" ><code class="code">USER_MATCH_MULTIPLE</code></a></dt> <dd> <p>Returned by <code class="code">match_field()</code> when at least one field matched more than one user, but no matches failed.</p> <dt><a name="USER_MATCH_FAILED" ><code class="code">USER_MATCH_FAILED</code></a></dt> <dd> <p>Returned by <code class="code">match_field()</code> when at least one field failed to match anything.</p> <dt><a name="USER_MATCH_SUCCESS" ><code class="code">USER_MATCH_SUCCESS</code></a></dt> <dd> <p>Returned by <code class="code">match_field()</code> when all fields successfully matched only one user.</p> <dt><a name="MATCH_SKIP_CONFIRM" ><code class="code">MATCH_SKIP_CONFIRM</code></a></dt> <dd> <p>Passed in to match_field to tell match_field to never display a confirmation screen.</p> </dd> </dl> <h1><a class='u' href='#___top' title='click to go to top of document' name="METHODS" >METHODS</a></h1> <h2><a class='u' href='#___top' title='click to go to top of document' name="Constructors" >Constructors</a></h2> <dl> <dt><a name="super_user" ><code class="code">super_user</code></a></dt> <dd> <p>Returns a user who is in all groups, but who does not really exist in the database. Used for non-web scripts like <a href="../checksetup.html" class="podlinkpod" >checksetup</a> that need to make database changes and so on.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="Saved_and_Shared_Queries" >Saved and Shared Queries</a></h2> <dl> <dt><a name="queries" ><code class="code">queries</code></a></dt> <dd> <p>Returns an arrayref of the user's own saved queries, sorted by name. The array contains <a href="../Bugzilla/Search/Saved.html" class="podlinkpod" >Bugzilla::Search::Saved</a> objects.</p> <dt><a name="queries_subscribed" ><code class="code">queries_subscribed</code></a></dt> <dd> <p>Returns an arrayref of shared queries that the user has subscribed to. That is, these are shared queries that the user sees in their footer. This array contains <a href="../Bugzilla/Search/Saved.html" class="podlinkpod" >Bugzilla::Search::Saved</a> objects.</p> <dt><a name="queries_available" ><code class="code">queries_available</code></a></dt> <dd> <p>Returns an arrayref of all queries to which the user could possibly subscribe. This includes the contents of <a href="#queries_subscribed" class="podlinkpod" >"queries_subscribed"</a>. An array of <a href="../Bugzilla/Search/Saved.html" class="podlinkpod" >Bugzilla::Search::Saved</a> objects.</p> <dt><a name="flush_queries_cache" ><code class="code">flush_queries_cache</code></a></dt> <dd> <p>Some code modifies the set of stored queries. Because <code class="code">Bugzilla::User</code> does not handle these modifications, but does cache the result of calling <code class="code">queries</code> internally, such code must call this method to flush the cached result.</p> <dt><a name="queryshare_groups" ><code class="code">queryshare_groups</code></a></dt> <dd> <p>An arrayref of group ids. The user can share their own queries with these groups.</p> <dt><a name="tags" ><code class="code">tags</code></a></dt> <dd> <p>Returns a hashref with tag IDs as key, and a hashref with tag 'id', 'name' and 'bug_count' as value.</p> <dt><a name="bugs_ignored" ><code class="code">bugs_ignored</code></a></dt> <dd> <p>Returns an array of hashrefs containing information about bugs currently being ignored by the user.</p> <p>Each hashref contains the following information:</p> <dl> <dt><a name="id" ><code class="code">id</code></a></dt> <dd> <p><code class="code">int</code> The id of the bug.</p> <dt><a name="status" ><code class="code">status</code></a></dt> <dd> <p><code class="code">string</code> The current status of the bug.</p> <dt><a name="summary" ><code class="code">summary</code></a></dt> <dd> <p><code class="code">string</code> The current summary of the bug.</p> </dd> </dl> <dt><a name="is_bug_ignored" ><code class="code">is_bug_ignored</code></a></dt> <dd> <p>Returns true if the user does not want email notifications for the specified bug ID, else returns false.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="Saved_Recent_Bug_Lists" >Saved Recent Bug Lists</a></h2> <dl> <dt><a name="recent_searches" ><code class="code">recent_searches</code></a></dt> <dd> <p>Returns an arrayref of <a href="../Bugzilla/Search/Recent.html" class="podlinkpod" >Bugzilla::Search::Recent</a> objects containing the user's recent searches.</p> <dt><a name="recent_search_containing(bug_id)" ><code class="code">recent_search_containing(bug_id)</code></a></dt> <dd> <p>Returns a <a href="../Bugzilla/Search/Recent.html" class="podlinkpod" >Bugzilla::Search::Recent</a> object that contains the most recent search by the user for the specified bug id. Retuns undef if no match is found.</p> <dt><a name="recent_search_for(bug)" ><code class="code">recent_search_for(bug)</code></a></dt> <dd> <p>Returns a <a href="../Bugzilla/Search/Recent.html" class="podlinkpod" >Bugzilla::Search::Recent</a> object that contains a search by the user. Uses the list_id of the current loaded page, or the referrer page, and the bug id if that fails. Finally it will check the BUGLIST cookie, and create an object based on that, or undef if it does not exist.</p> <dt><a name="save_last_search" ><code class="code">save_last_search</code></a></dt> <dd> <p>Saves the users most recent search in the database if logged in, or in the BUGLIST cookie if not logged in. Parameters are bug_ids, order, vars and list_id.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="Account_Lockout" >Account Lockout</a></h2> <dl> <dt><a name="account_is_locked_out" ><code class="code">account_is_locked_out</code></a></dt> <dd> <p>Returns <code class="code">1</code> if the account has failed to log in too many times recently, and thus is locked out for a period of time. Returns <code class="code">0</code> otherwise.</p> <dt><a name="account_ip_login_failures" ><code class="code">account_ip_login_failures</code></a></dt> <dd> <p>Returns an arrayref of hashrefs, that contains information about the recent times that this account has failed to log in from the current remote IP. The hashes contain <code class="code">ip_addr</code>, <code class="code">login_time</code>, and <code class="code">user_id</code>.</p> <dt><a name="note_login_failure" ><code class="code">note_login_failure</code></a></dt> <dd> <p>This notes that this account has failed to log in, and stores the fact in the database. The storing happens immediately, it does not wait for you to call <code class="code">update</code>.</p> <dt><a name="set_email_enabled" ><code class="code">set_email_enabled</code></a></dt> <dd> <p><code class="code">bool</code> - Sets <code class="code">disable_mail</code> to the inverse of the boolean provided.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="Other_Methods" >Other Methods</a></h2> <dl> <dt><a name="id" ><code class="code">id</code></a></dt> <dd> <p>Returns the userid for this user.</p> <dt><a name="login" ><code class="code">login</code></a></dt> <dd> <p>Returns the login name for this user.</p> <dt><a name="email" ><code class="code">email</code></a></dt> <dd> <p>Returns the user's email address. Currently this is the same value as the login.</p> <dt><a name="name" ><code class="code">name</code></a></dt> <dd> <p>Returns the 'real' name for this user, if any.</p> <dt><a name="showmybugslink" ><code class="code">showmybugslink</code></a></dt> <dd> <p>Returns <code class="code">1</code> if the user has set their preference to show the 'My Bugs' link in the page footer, and <code class="code">0</code> otherwise.</p> <dt><a name="identity" ><code class="code">identity</code></a></dt> <dd> <p>Returns a string for the identity of the user. This will be of the form <code class="code">name <email></code> if the user has specified a name, and <code class="code">email</code> otherwise.</p> <dt><a name="nick" ><code class="code">nick</code></a></dt> <dd> <p>Returns a user "nickname" -- i.e. a shorter, not-necessarily-unique name by which to identify the user. Currently the part of the user's email address before the at sign (@), but that could change, especially if we implement usernames not dependent on email address.</p> <dt><a name="authorizer" ><code class="code">authorizer</code></a></dt> <dd> <p>This is the <a href="../Bugzilla/Auth.html" class="podlinkpod" >Bugzilla::Auth</a> object that the User logged in with. If the user hasn't logged in yet, a new, empty Bugzilla::Auth() object is returned.</p> <dt><a name="set_authorizer($authorizer)" ><code class="code">set_authorizer($authorizer)</code></a></dt> <dd> <p>Sets the <a href="../Bugzilla/Auth.html" class="podlinkpod" >Bugzilla::Auth</a> object to be returned by <code class="code">authorizer()</code>. Should only be called by <code class="code">Bugzilla::Auth::login</code>, for the most part.</p> <dt><a name="disabledtext" ><code class="code">disabledtext</code></a></dt> <dd> <p>Returns the disable text of the user, if any.</p> <dt><a name="reports" ><code class="code">reports</code></a></dt> <dd> <p>Returns an arrayref of the user's own saved reports. The array contains <a href="../Bugzilla/Reports.html" class="podlinkpod" >Bugzilla::Reports</a> objects.</p> <dt><a name="flush_reports_cache" ><code class="code">flush_reports_cache</code></a></dt> <dd> <p>Some code modifies the set of stored reports. Because <code class="code">Bugzilla::User</code> does not handle these modifications, but does cache the result of calling <code class="code">reports</code> internally, such code must call this method to flush the cached result.</p> <dt><a name="settings" ><code class="code">settings</code></a></dt> <dd> <p>Returns a hash of hashes which holds the user's settings. The first key is the name of the setting, as found in setting.name. The second key is one of: is_enabled - true if the user is allowed to set the preference themselves; false to force the site defaults for themselves or must accept the global site default value default_value - the global site default for this setting value - the value of this setting for this user. Will be the same as the default_value if the user is not logged in, or if is_default is true. is_default - a boolean to indicate whether the user has chosen to make a preference for themself or use the site default.</p> <dt><a name="setting(name)" ><code class="code">setting(name)</code></a></dt> <dd> <p>Returns the value for the specified setting.</p> <dt><a name="timezone" ><code class="code">timezone</code></a></dt> <dd> <p>Returns the timezone used to display dates and times to the user, as a DateTime::TimeZone object.</p> <dt><a name="groups" ><code class="code">groups</code></a></dt> <dd> <p>Returns an arrayref of <a href="../Bugzilla/Group.html" class="podlinkpod" >Bugzilla::Group</a> objects representing groups that this user is a member of.</p> <dt><a name="groups_as_string" ><code class="code">groups_as_string</code></a></dt> <dd> <p>Returns a string containing a comma-separated list of numeric group ids. If the user is not a member of any groups, returns "-1". This is most often used within an SQL IN() function.</p> <dt><a name="groups_in_sql" ><code class="code">groups_in_sql</code></a></dt> <dd> <p>This returns an <code class="code">IN</code> clause for SQL, containing either all of the groups the user is in, or <code class="code">-1</code> if the user is in no groups. This takes one argument--the name of the SQL field that should be on the left-hand-side of the <code class="code">IN</code> statement, which defaults to <code class="code">group_id</code> if not specified.</p> <dt><a name="in_group($group_name,_$product_id)" ><code class="code">in_group($group_name, $product_id)</code></a></dt> <dd> <p>Determines whether or not a user is in the given group by name. If $product_id is given, it also checks for local privileges for this product.</p> <dt><a name="in_group_id" ><code class="code">in_group_id</code></a></dt> <dd> <p>Determines whether or not a user is in the given group by id.</p> <dt><a name="bless_groups" ><code class="code">bless_groups</code></a></dt> <dd> <p>Returns an arrayref of <a href="../Bugzilla/Group.html" class="podlinkpod" >Bugzilla::Group</a> objects.</p> <p>The arrayref consists of the groups the user can bless, taking into account that having editusers permissions means that you can bless all groups, and that you need to be able to see a group in order to bless it.</p> <dt><a name="get_products_by_permission($group)" ><code class="code">get_products_by_permission($group)</code></a></dt> <dd> <p>Returns a list of product objects for which the user has $group privileges and which they can access. $group must be one of the groups defined in PER_PRODUCT_PRIVILEGES.</p> <dt><a name="can_see_user(user)" ><code class="code">can_see_user(user)</code></a></dt> <dd> <p>Returns 1 if the specified user account exists and is visible to the user, 0 otherwise.</p> <dt><a name="can_edit_product(prod_id)" ><code class="code">can_edit_product(prod_id)</code></a></dt> <dd> <p>Determines if, given a product id, the user can edit bugs in this product at all.</p> <dt><a name="visible_bugs($bugs)" ><code class="code">visible_bugs($bugs)</code></a></dt> <dd> <p>Description: Determines if a list of bugs are visible to the user. Params: <code class="code">$bugs</code> - An arrayref of Bugzilla::Bug objects or bug ids Returns: An arrayref of the bug ids that the user can see</p> <dt><a name="can_see_bug(bug_id)" ><code class="code">can_see_bug(bug_id)</code></a></dt> <dd> <p>Determines if the user can see the specified bug.</p> <dt><a name="can_see_product(product_name)" ><code class="code">can_see_product(product_name)</code></a></dt> <dd> <p>Returns 1 if the user can access the specified product, and 0 if the user should not be aware of the existence of the product.</p> <dt><a name="derive_regexp_groups" ><code class="code">derive_regexp_groups</code></a></dt> <dd> <p>Bugzilla allows for group inheritance. When data about the user (or any of the groups) changes, the database must be updated. Handling updated groups is taken care of by the constructor. However, when updating the email address, the user may be placed into different groups, based on a new email regexp. This method should be called in such a case to force reresolution of these groups.</p> <dt><a name="clear_product_cache" ><code class="code">clear_product_cache</code></a></dt> <dd> <p>Clears the stored values for <a href="#get_selectable_products" class="podlinkpod" >"get_selectable_products"</a>, <a href="#get_enterable_products" class="podlinkpod" >"get_enterable_products"</a>, etc. so that their data will be read from the database again. Used mostly by <a href="../Bugzilla/Product.html" class="podlinkpod" >Bugzilla::Product</a>.</p> <dt><a name="get_selectable_products" ><code class="code">get_selectable_products</code></a></dt> <dd> <pre class="code"> Description: Returns all products the user is allowed to access. This list is restricted to some given classification if $classification_id is given. Params: $classification_id - (optional) The ID of the classification the products belong to. Returns: An array of product objects, sorted by the product name.</pre> <dt><a name="get_selectable_classifications" ><code class="code">get_selectable_classifications</code></a></dt> <dd> <pre class="code"> Description: Returns all classifications containing at least one product the user is allowed to view. Params: none Returns: An array of Bugzilla::Classification objects, sorted by the classification name.</pre> <dt><a name="can_enter_product($product_name,_$warn)" ><code class="code">can_enter_product($product_name, $warn)</code></a></dt> <dd> <pre class="code"> Description: Returns a product object if the user can enter bugs into the specified product. If the user cannot enter bugs into the product, the behavior of this method depends on the value of $warn: - if $warn is false (or not given), a 'false' value is returned; - if $warn is true, an error is thrown. Params: $product_name - a product name. $warn - optional parameter, indicating whether an error must be thrown if the user cannot enter bugs into the specified product. Returns: A product object if the user can enter bugs into the product, 0 if the user cannot enter bugs into the product and if $warn is false (an error is thrown if $warn is true).</pre> <dt><a name="get_enterable_products" ><code class="code">get_enterable_products</code></a></dt> <dd> <pre class="code"> Description: Returns an array of product objects into which the user is allowed to enter bugs. Params: none Returns: an array of product objects.</pre> <dt><a name="can_access_product($product)" ><code class="code">can_access_product($product)</code></a></dt> <dd> <p>Returns 1 if the user can search or enter bugs into the specified product (either a <a href="../Bugzilla/Product.html" class="podlinkpod" >Bugzilla::Product</a> or a product name), and 0 if the user should not be aware of the existence of the product.</p> <dt><a name="get_accessible_products" ><code class="code">get_accessible_products</code></a></dt> <dd> <pre class="code"> Description: Returns an array of product objects the user can search or enter bugs against. Params: none Returns: an array of product objects.</pre> <dt><a name="can_administer" ><code class="code">can_administer</code></a></dt> <dd> <p>Returns 1 if the user can see the admin menu. Otherwise, returns 0</p> <dt><a name="check_can_admin_product($product_name)" ><code class="code">check_can_admin_product($product_name)</code></a></dt> <dd> <pre class="code"> Description: Checks whether the user is allowed to administrate the product. Params: $product_name - a product name. Returns: On success, a product object. On failure, an error is thrown.</pre> <dt><a name="check_can_admin_flagtype($flagtype_id)" ><code class="code">check_can_admin_flagtype($flagtype_id)</code></a></dt> <dd> <pre class="code"> Description: Checks whether the user is allowed to edit properties of the flag type. If the flag type is also used by some products for which the user hasn't editcomponents privs, then the user is only allowed to edit the inclusion and exclusion lists for products they can administrate. Params: $flagtype_id - a flag type ID. Returns: On success, a flag type object. On failure, an error is thrown. In list context, a boolean indicating whether the user can edit all properties of the flag type is also returned. The boolean is false if the user can only edit the inclusion and exclusions lists.</pre> <dt><a name="can_request_flag($flag_type)" ><code class="code">can_request_flag($flag_type)</code></a></dt> <dd> <pre class="code"> Description: Checks whether the user can request flags of the given type. Params: $flag_type - a Bugzilla::FlagType object. Returns: 1 if the user can request flags of the given type, 0 otherwise.</pre> <dt><a name="can_set_flag($flag_type)" ><code class="code">can_set_flag($flag_type)</code></a></dt> <dd> <pre class="code"> Description: Checks whether the user can set flags of the given type. Params: $flag_type - a Bugzilla::FlagType object. Returns: 1 if the user can set flags of the given type, 0 otherwise.</pre> <dt><a name="get_userlist" ><code class="code">get_userlist</code></a></dt> <dd> <p>Returns a reference to an array of users. The array is populated with hashrefs containing the login, identity and visibility. Users that are not visible to this user will have 'visible' set to zero.</p> <dt><a name="visible_groups_inherited" ><code class="code">visible_groups_inherited</code></a></dt> <dd> <p>Returns a list of all groups whose members should be visible to this user. Since this list is flattened already, there is no need for all users to be have derived groups up-to-date to select the users meeting this criteria.</p> <dt><a name="visible_groups_direct" ><code class="code">visible_groups_direct</code></a></dt> <dd> <p>Returns a list of groups that the user is aware of.</p> <dt><a name="visible_groups_as_string" ><code class="code">visible_groups_as_string</code></a></dt> <dd> <p>Returns the result of <code class="code">visible_groups_inherited</code> as a string (a comma-separated list).</p> <dt><a name="product_responsibilities" ><code class="code">product_responsibilities</code></a></dt> <dd> <p>Retrieve user's product responsibilities as a list of component objects. Each object is a component the user has a responsibility for.</p> <dt><a name="can_bless" ><code class="code">can_bless</code></a></dt> <dd> <p>When called with no arguments: Returns <code class="code">1</code> if the user can bless at least one group, returns <code class="code">0</code> otherwise.</p> <p>When called with one argument: Returns <code class="code">1</code> if the user can bless the group with that id, returns <code class="code">0</code> otherwise.</p> <dt><a name="wants_bug_mail" ><code class="code">wants_bug_mail</code></a></dt> <dd> <p>Returns true if the user wants mail for a given bug change.</p> <dt><a name="wants_mail" ><code class="code">wants_mail</code></a></dt> <dd> <p>Returns true if the user wants mail for a given set of events. This method is more general than <code class="code">wants_bug_mail</code>, allowing you to check e.g. permissions for flag mail.</p> <dt><a name="is_insider" ><code class="code">is_insider</code></a></dt> <dd> <p>Returns true if the user can access private comments and attachments, i.e. if the 'insidergroup' parameter is set and the user belongs to this group.</p> <dt><a name="is_global_watcher" ><code class="code">is_global_watcher</code></a></dt> <dd> <p>Returns true if the user is a global watcher, i.e. if the 'globalwatchers' parameter contains the user.</p> <dt><a name="can_tag_comments" ><code class="code">can_tag_comments</code></a></dt> <dd> <p>Returns true if the user can attach tags to comments. i.e. if the 'comment_taggers_group' parameter is set and the user belongs to this group.</p> <dt><a name="last_visited" ><code class="code">last_visited</code></a></dt> <dd> <p>Returns an arrayref <a href="../Bugzilla/BugUserLastVisit.html" class="podlinkpod" >Bugzilla::BugUserLastVisit</a> objects.</p> <dt><a name="is_involved_in_bug($bug)" ><code class="code">is_involved_in_bug($bug)</code></a></dt> <dd> <p>Returns true if any of the following conditions are met, false otherwise.</p> <ul> <li>User is the assignee of the bug</li> <li>User is the reporter of the bug</li> <li>User is the QA contact of the bug (if Bugzilla is configured to use a QA contact)</li> <li>User is in the cc list for the bug.</li> </ul> <dt><a name="set_groups" ><code class="code">set_groups</code></a></dt> <dd> <p><code class="code">hash</code> These specify the groups that this user is directly a member of. To set these, you should pass a hash as the value. The hash may contain the following fields:</p> <dl> <dt><a name="add_An_array_of_ints_or_strings._The_group_ids_or_group_names_that_the_user_should_be_added_to." ><code class="code">add</code> An array of <code class="code">int</code>s or <code class="code">string</code>s. The group ids or group names that the user should be added to.</a></dt> <dd> <dt><a name="remove_An_array_of_ints_or_strings._The_group_ids_or_group_names_that_the_user_should_be_removed_from." ><code class="code">remove</code> An array of <code class="code">int</code>s or <code class="code">string</code>s. The group ids or group names that the user should be removed from.</a></dt> <dd> <dt><a ><code class="code">set</code> An array of <code class="code">int</code>s or <code class="code">string</code>s. An exact set of group ids and group names that the user should be a member of. NOTE: This does not remove groups from the user where the person making the change does not have the bless privilege for.</a></dt> <dd> <p>If you specify <code class="code">set</code>, then <code class="code">add</code> and <code class="code">remove</code> will be ignored. A group in both the <code class="code">add</code> and <code class="code">remove</code> list will be added. Specifying a group that the user making the change does not have bless rights will generate an error.</p> </dd> </dl> <dt><a name="set_bless_groups" ><code class="code">set_bless_groups</code></a></dt> <dd> <p><code class="code">hash</code> - This is the same as set_groups, but affects what groups a user has direct membership to bless that group. It takes the same inputs as set_groups.</p> </dd> </dl> <h1><a class='u' href='#___top' title='click to go to top of document' name="CLASS_FUNCTIONS" >CLASS FUNCTIONS</a></h1> <p>These are functions that are not called on a User object, but instead are called "statically," just like a normal procedural function.</p> <dl> <dt><a name="create" ><code class="code">create</code></a></dt> <dd> <p>The same as <a href="../Bugzilla/Object.html#create" class="podlinkpod" >"create" in Bugzilla::Object</a>.</p> <p>Params: login_name - <b>Required</b> The login name for the new user. realname - The full name for the new user. cryptpassword - <b>Required</b> The password for the new user. Even though the name says "crypt", you should just specify a plain-text password. If you specify '*', the user will not be able to log in using DB authentication. disabledtext - The disable-text for the new user. If given, the user will be disabled, meaning they cannot log in. Defaults to an empty string. disable_mail - If 1, bug-related mail will not be sent to this user; if 0, mail will be sent depending on the user's email preferences.</p> <dt><a name="check" ><code class="code">check</code></a></dt> <dd> <p>Takes a username as its only argument. Throws an error if there is no user with that username. Returns a <code class="code">Bugzilla::User</code> object.</p> <dt><a name="check_account_creation_enabled" ><code class="code">check_account_creation_enabled</code></a></dt> <dd> <p>Checks that users can create new user accounts, and throws an error if user creation is disabled.</p> <dt><a name="check_and_send_account_creation_confirmation($login)" ><code class="code">check_and_send_account_creation_confirmation($login)</code></a></dt> <dd> <p>If the user request for a new account passes validation checks, an email is sent to this user for confirmation. Otherwise an error is thrown indicating why the request has been rejected.</p> <dt><a name="is_available_username" ><code class="code">is_available_username</code></a></dt> <dd> <p>Returns a boolean indicating whether or not the supplied username is already taken in Bugzilla.</p> <p>Params: $username (scalar, string) - The full login name of the username that you are checking. $old_username (scalar, string) - If you are checking an email-change token, insert the "old" username that the user is changing from, here. Then, as long as it's the right user for that token, they can change their username to $username. (That is, this function will return a boolean true value).</p> <dt><a name="login_to_id($login,_$throw_error)" ><code class="code">login_to_id($login, $throw_error)</code></a></dt> <dd> <p>Takes a login name of a Bugzilla user and changes that into a numeric ID for that user. This ID can then be passed to Bugzilla::User::new to create a new user.</p> <p>If no valid user exists with that login name, then the function returns 0. However, if $throw_error is set, the function will throw a user error instead of returning.</p> <p>This function can also be used when you want to just find out the userid of a user, but you don't want the full weight of Bugzilla::User.</p> <p>However, consider using a Bugzilla::User object instead of this function if you need more information about the user than just their ID.</p> <dt><a name="validate_password($passwd1,_$passwd2)" ><code class="code">validate_password($passwd1, $passwd2)</code></a></dt> <dd> <p>Returns true if a password is valid (i.e. meets Bugzilla's requirements for length and content), else throws an error. Untaints <code class="code">$passwd1</code> if successful.</p> <p>If a second password is passed in, this function also verifies that the two passwords match.</p> <dt><a name="validate_password_check($passwd1,_$passwd2)" ><code class="code">validate_password_check($passwd1, $passwd2)</code></a></dt> <dd> <p>This sub routine is similair to <code class="code">validate_password</code>, except that it allows the calling code to handle its own errors.</p> <p>Returns undef and untaints <code class="code">$passwd1</code> if a password is valid (i.e. meets Bugzilla's requirements for length and content), else returns the error.</p> <p>If a second password is passed in, this function also verifies that the two passwords match.</p> <dt><a name="match_field($data,_$fields,_$behavior)" ><code class="code">match_field($data, $fields, $behavior)</code></a></dt> <dd> <dl> <dt><a name="Description" ><b>Description</b></a></dt> <dd> <p>Wrapper for the <code class="code">match()</code> function.</p> <dt><a name="Params" ><b>Params</b></a></dt> <dd> <dl> <dt><a ><code class="code">$fields</code> - A hashref with field names as keys and a hash as values. Each hash is of the form { 'type' => 'single|multi' }, which specifies whether the field can take a single login name only or several.</a></dt> <dd> <dt><a ><code class="code">$data</code> (optional) - A hashref with field names as keys and field values as values. If undefined, <code class="code">Bugzilla->input_params</code> is used.</a></dt> <dd> <dt><a ><code class="code">$behavior</code> (optional) - If set to <code class="code">MATCH_SKIP_CONFIRM</code>, no confirmation screen is displayed. In that case, the fields which don't match a unique user are left undefined. If not set, a confirmation screen is displayed if at least one field doesn't match any login name or match more than one.</a></dt> </dl> <dt><a name="Returns" ><b>Returns</b></a></dt> <dd> <p>If the third parameter is set to <code class="code">MATCH_SKIP_CONFIRM</code>, the function returns either <code class="code">USER_MATCH_SUCCESS</code> if all fields can be set unambiguously, <code class="code">USER_MATCH_FAILED</code> if at least one field doesn't match any user account, or <code class="code">USER_MATCH_MULTIPLE</code> if some fields match more than one user account.</p> <p>If the third parameter is not set, then if all fields could be set unambiguously, nothing is returned, else a confirmation page is displayed.</p> <dt><a name="Note" ><b>Note</b></a></dt> <dd> <p>This function must be called early in a script, before anything external is done with the data.</p> </dd> </dl> </dd> </dl> <h1><a class='u' href='#___top' title='click to go to top of document' name="SEE_ALSO" >SEE ALSO</a></h1> <p><a href="../Bugzilla.html" class="podlinkpod" >Bugzilla</a></p> <h1><a class='u' href='#___top' title='click to go to top of document' name="Methods_in_need_of_POD" ><b>Methods in need of POD</b></a></h1> <dl> <dt><a name="email_enabled" >email_enabled</a></dt> <dd> <dt><a name="cryptpassword" >cryptpassword</a></dt> <dd> <dt><a name="clear_login_failures" >clear_login_failures</a></dt> <dd> <dt><a name="set_disable_mail" >set_disable_mail</a></dt> <dd> <dt><a name="has_audit_entries" >has_audit_entries</a></dt> <dd> <dt><a name="groups_with_icon" >groups_with_icon</a></dt> <dd> <dt><a name="check_login_name" >check_login_name</a></dt> <dd> <dt><a name="set_extern_id" >set_extern_id</a></dt> <dd> <dt><a name="mail_settings" >mail_settings</a></dt> <dd> <dt><a name="email_disabled" >email_disabled</a></dt> <dd> <dt><a name="update" >update</a></dt> <dd> <dt><a name="is_timetracker" >is_timetracker</a></dt> <dd> <dt><a name="is_enabled" >is_enabled</a></dt> <dd> <dt><a name="queryshare_groups_as_string" >queryshare_groups_as_string</a></dt> <dd> <dt><a name="set_login" >set_login</a></dt> <dd> <dt><a name="set_password" >set_password</a></dt> <dd> <dt><a name="last_seen_date" >last_seen_date</a></dt> <dd> <dt><a name="set_disabledtext" >set_disabledtext</a></dt> <dd> <dt><a name="update_last_seen_date" >update_last_seen_date</a></dt> <dd> <dt><a name="set_name" >set_name</a></dt> <dd> <dt><a name="DB_COLUMNS" >DB_COLUMNS</a></dt> <dd> <dt><a name="extern_id" >extern_id</a></dt> <dd> <dt><a name="UPDATE_COLUMNS" >UPDATE_COLUMNS</a></dt> </dl> <p class="backlinkbottom"><b><a name="___bottom" href="../index.html" title="All Documents"><<</a></b></p> <!-- end doc --> </body></html>