From 102f50dc4d94cbddc39d90acaf7fd77ac49cc473 Mon Sep 17 00:00:00 2001 From: Frank Becker Date: Sun, 4 Nov 2012 12:14:56 +0100 Subject: Bug 741722: Product.get should include flag_types information r=dkl a=LpSolit --- Bugzilla/WebService/Product.pm | 111 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 108 insertions(+), 3 deletions(-) (limited to 'Bugzilla/WebService') diff --git a/Bugzilla/WebService/Product.pm b/Bugzilla/WebService/Product.pm index c1308bedc..19a016fbc 100644 --- a/Bugzilla/WebService/Product.pm +++ b/Bugzilla/WebService/Product.pm @@ -209,7 +209,7 @@ sub _product_to_hash { }; if (filter_wants($params, 'components')) { $field_data->{components} = [map { - $self->_component_to_hash($_) + $self->_component_to_hash($_, $params) } @{$product->components}]; } if (filter_wants($params, 'versions')) { @@ -226,8 +226,8 @@ sub _product_to_hash { } sub _component_to_hash { - my ($self, $component) = @_; - return { + my ($self, $component, $params) = @_; + my $field_data = { id => $self->type('int', $component->id), name => @@ -243,7 +243,47 @@ sub _component_to_hash { 0, is_active => $self->type('boolean', $component->is_active), + flag_types => { + bug => + [map { + $self->_flag_type_to_hash($_, $params) + } @{$component->flag_types->{'bug'}}], + attachment => + [map { + $self->_flag_type_to_hash($_, $params) + } @{$component->flag_types->{'attachment'}}], + } + }; + return filter($params, $field_data, 'component'); +} + +sub _flag_type_to_hash { + my ($self, $flag_type, $params) = @_; + my $field_data = { + id => + $self->type('int', $flag_type->id), + name => + $self->type('string', $flag_type->name), + description => + $self->type('string', $flag_type->description), + cc_list => + $self->type('string', $flag_type->cc_list), + sort_key => + $self->type('int', $flag_type->sortkey), + is_active => + $self->type('boolean', $flag_type->is_active), + is_requestable => + $self->type('boolean', $flag_type->is_requestable), + is_requesteeble => + $self->type('boolean', $flag_type->is_requesteeble), + is_multiplicable => + $self->type('boolean', $flag_type->is_multiplicable), + grant_group => + $self->type('int', $flag_type->grant_group_id), + request_group => + $self->type('int', $flag_type->request_group_id), }; + return filter($params, $field_data, 'flag_type'); } sub _version_to_hash { @@ -469,6 +509,68 @@ and then secondly by their name. C A boolean indicating if the component is active. Inactive components are not enabled for new bugs. +=item C + +A hash containing the two items C and C that each contains an +array of hashes, where each hash describes a flagtype, and has the +following items: + +=over + +=item C + +C Returns the ID of the flagtype. + +=item C + +C Returns the name of the flagtype. + +=item C + +C Returns the description of the flagtype. + +=item C + +C Returns the concatenated CC list for the flagtype, as a single string. + +=item C + +C Returns the sortkey of the flagtype. + +=item C + +C Returns whether the flagtype is active or disabled. Flags being +in a disabled flagtype are not deleted. It only prevents you from +adding new flags to it. + +=item C + +C Returns whether you can request for the given flagtype +(i.e. whether the '?' flag is available or not). + +=item C + +C Returns whether you can ask someone specifically or not. + +=item C + +C Returns whether you can have more than one flag for the given +flagtype in a given bug/attachment. + +=item C + +C the group id that is allowed to grant/deny flags of this type. +If the item is not included all users are allowed to grant/deny this +flagtype. + +=item C + +C the group id that is allowed to request the flag if the flag +is of the type requestable. If the item is not included all users +are allowed request this flagtype. + +=back + =back =item C @@ -501,6 +603,9 @@ C, C and C were added to the fields returned by C as a replacement for C, which has been removed. +=item In Bugzilla B<4.4>, C was added to the fields returned +by C. + =back =back -- cgit v1.2.3-24-g4f1b