summaryrefslogtreecommitdiffstats
path: root/Bugzilla/User.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2006-09-20 06:47:49 +0200
committerlpsolit%gmail.com <>2006-09-20 06:47:49 +0200
commitf90a0b775e927aad00631ce80d282186a3022af5 (patch)
tree37b896b80e108ecbb73544a164528521ae7a1288 /Bugzilla/User.pm
parent0fccdb26ae49bd8bb6022d48b769595e0a328278 (diff)
downloadbugzilla-f90a0b775e927aad00631ce80d282186a3022af5.tar.gz
bugzilla-f90a0b775e927aad00631ce80d282186a3022af5.tar.xz
Bug 348518: grant / reject options for flag listbox should only appear if user is a member of grantgroup - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=myk
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r--Bugzilla/User.pm33
1 files changed, 33 insertions, 0 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 4cb2c4469..961b2ca0b 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -642,6 +642,21 @@ sub get_enterable_products {
return $self->{enterable_products};
}
+sub can_request_flag {
+ my ($self, $flag_type) = @_;
+
+ return ($self->can_set_flag($flag_type)
+ || !$flag_type->request_group
+ || $self->in_group_id($flag_type->request_group->id)) ? 1 : 0;
+}
+
+sub can_set_flag {
+ my ($self, $flag_type) = @_;
+
+ return (!$flag_type->grant_group
+ || $self->in_group_id($flag_type->grant_group->id)) ? 1 : 0;
+}
+
# visible_groups_inherited returns a reference to a list of all the groups
# whose members are visible to this user.
sub visible_groups_inherited {
@@ -1741,6 +1756,24 @@ method should be called in such a case to force reresolution of these groups.
Returns: an array of product objects.
+=item C<can_request_flag($flag_type)>
+
+ 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.
+
+=item C<can_set_flag($flag_type)>
+
+ 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.
+
=item C<get_userlist>
Returns a reference to an array of users. The array is populated with hashrefs