<<

Bugzilla::Group

NAME

Bugzilla::Group - Bugzilla group class.

SYNOPSIS

    use Bugzilla::Group;

    my $group = new Bugzilla::Group(1);
    my $group = new Bugzilla::Group({name => 'AcmeGroup'});

    my $id           = $group->id;
    my $name         = $group->name;
    my $description  = $group->description;
    my $user_reg_exp = $group->user_reg_exp;
    my $is_active    = $group->is_active;
    my $icon_url     = $group->icon_url;
    my $is_active_bug_group = $group->is_active_bug_group;

    my $group_id = Bugzilla::Group::ValidateGroupName('admin', @users);
    my @groups   = Bugzilla::Group->get_all;

DESCRIPTION

Group.pm represents a Bugzilla Group object. It is an implementation of Bugzilla::Object, and thus has all the methods that Bugzilla::Object provides, in addition to any methods documented below.

SUBROUTINES

create

Note that in addition to what "create($params)" in Bugzilla::Object normally does, this function also makes the new group be inherited by the admin group. That is, the admin group will automatically be a member of this group.

ValidateGroupName($name, @users)

Description: ValidateGroupName checks to see if ANY of the users in the provided list of user objects can see the named group.

Params: $name - String with the group name. @users - An array with Bugzilla::User objects.

Returns: It returns the group id if successful and undef otherwise.

METHODS

check_no_disclose
Description

Throws an error if the user cannot add or remove this group to/from a given bug, but doesn't specify if this is because the group doesn't exist, or the user is not allowed to edit this group restriction.

Params

This method takes a single hashref as argument, with the following keys:

name

string The name of the group to add or remove.

bug_id

integer The ID of the bug to which the group change applies.

product

string The name of the product the bug belongs to.

action

string Must be either add or remove, depending on whether the group must be added or removed from the bug. Any other value will generate an error.

Returns

A Bugzilla::Group object on success, else an error is thrown.

check_members_are_visible

Throws an error if this group is not visible (according to visibility groups) to the currently-logged-in user.

check_remove
Description

Determines whether it's OK to remove this group from the database, and throws an error if it's not OK.

Params
test_only

boolean If you want to only check if the group can be deleted at all, under any circumstances, specify test_only to just do the most basic tests (the other parameters will be ignored in this situation, as those tests won't be run).

remove_from_users

boolean True if it would be OK to remove all users who are in this group from this group.

remove_from_bugs

boolean True if it would be OK to remove all bugs that are in this group from this group.

remove_from_flags

boolean True if it would be OK to stop all flagtypes that reference this group from referencing this group (e.g., as their grantgroup or requestgroup).

remove_from_products

boolean True if it would be OK to remove this group from all group controls on products.

Returns (nothing)
members_non_inherited

Returns an arrayref of Bugzilla::User objects representing people who are "directly" in this group, meaning that they're in it because they match the group regular expression, or they have been actually added to the group manually.

flatten_group_membership

Accepts a list of groups and returns a list of all the groups whose members inherit membership in any group on the list. So, we can determine if a user is in any of the groups input to flatten_group_membership by querying the user_group_map for any user with DIRECT or REGEXP membership IN() the list of groups returned.

<<