diff options
author | mkanat%kerio.com <> | 2005-08-10 05:31:53 +0200 |
---|---|---|
committer | mkanat%kerio.com <> | 2005-08-10 05:31:53 +0200 |
commit | 3e7b43ab8ebe5cbe04081bb9d68007d4acfa7d3b (patch) | |
tree | b5bfa181cc3e7ae876f1ee9bb4663ae0503568ff /Bugzilla | |
parent | dd4724f7c8389c73f8f1bef35f88b8a9d2f0bfdf (diff) | |
download | bugzilla-3e7b43ab8ebe5cbe04081bb9d68007d4acfa7d3b.tar.gz bugzilla-3e7b43ab8ebe5cbe04081bb9d68007d4acfa7d3b.tar.xz |
Bug 300231: Bugzilla::Classification needs a way of returning only Selectable classification objects
Patch By Gabriel Sales de Oliveira <gabriel@async.com.br> r=mkanat, a=justdave
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/User.pm | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index f9efcd248..e9d510295 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -41,6 +41,7 @@ use Bugzilla::Error; use Bugzilla::Util; use Bugzilla::Constants; use Bugzilla::User::Setting; +use Bugzilla::Product; use base qw(Exporter); @Bugzilla::User::EXPORT = qw(insert_new_user is_available_username @@ -60,6 +61,8 @@ use constant USER_MATCH_SUCCESS => 1; use constant MATCH_SKIP_CONFIRM => 1; +use constant GET_PRODUCTS_BY_ID => 1; + ################################################################################ # Functions ################################################################################ @@ -442,6 +445,27 @@ sub get_selectable_products { return values(%list); } +sub get_selectable_classifications ($) { + my ($self) = @_; + + if (defined $self->{selectable_classifications}) { + return $self->{selectable_classifications}; + } + + my $products = $self->get_selectable_products(GET_PRODUCTS_BY_ID); + + my $selectable_classifications; + + foreach my $prod_id (keys %$products) { + my $product = new Bugzilla::Product($prod_id); + + $selectable_classifications->{$product->classification_id} = + $product->classification; + } + $self->{selectable_classifications} = + [values %$selectable_classifications]; +} + # visible_groups_inherited returns a reference to a list of all the groups # whose members are visible to this user. sub visible_groups_inherited { @@ -1270,6 +1294,9 @@ Bugzilla::User - Object for a Bugzilla user my $user = new Bugzilla::User($id); + my @get_selectable_classifications = + $user->get_selectable_classifications; + # Class Functions $password = insert_new_user($username, $realname, $password, $disabledtext); @@ -1459,6 +1486,16 @@ the user can select bugs. If the $by_id parameter is true, it returns a hash where the keys are the product ids and the values are the product names. +=item C<get_selectable_classifications> + + Description: Returns the classifications that a user, according his + groups ownership, can select to entering, serch, view or + edit a bug. + + Params: none. + + Returns: Bugzilla::Classification objects values. + =item C<get_userlist> Returns a reference to an array of users. The array is populated with hashrefs |