From 46e5d925026ccde28118bfcf28061c75f188b066 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Mon, 26 Nov 2012 20:20:29 +0100 Subject: Bug 718289: The deadline field should be visible by non-members of the timetracking group r=dkl a=LpSolit --- Bugzilla/Bug.pm | 11 +++++------ Bugzilla/Constants.pm | 3 +-- Bugzilla/Search.pm | 3 +-- Bugzilla/WebService/Bug.pm | 11 ++++------- 4 files changed, 11 insertions(+), 17 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index b72a8fcdb..7a3ec4c8a 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -3734,9 +3734,7 @@ sub editable_bug_fields { # Custom multi-select fields are not stored in the bugs table. splice(@fields, $location, 1) if ($location > -1); } - # Sorted because the old @::log_columns variable, which this replaces, - # was sorted. - return sort(@fields); + return @fields; } # XXX - When Bug::update() will be implemented, we should make this routine @@ -4048,9 +4046,10 @@ sub check_can_change_field { # $PrivilegesRequired = PRIVILEGES_REQUIRED_REPORTER : the reporter, assignee or an empowered user; # $PrivilegesRequired = PRIVILEGES_REQUIRED_ASSIGNEE : the assignee or an empowered user; # $PrivilegesRequired = PRIVILEGES_REQUIRED_EMPOWERED : an empowered user. - - # Only users in the time-tracking group can change time-tracking fields. - if ( grep($_ eq $field, TIMETRACKING_FIELDS) ) { + + # Only users in the time-tracking group can change time-tracking fields, + # including the deadline. + if (grep { $_ eq $field } (TIMETRACKING_FIELDS, 'deadline')) { if (!$user->is_timetracker) { $$PrivilegesRequired = PRIVILEGES_REQUIRED_EMPOWERED; return 0; diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index 514c81143..dbb1edf74 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -399,8 +399,7 @@ use constant ABNORMAL_SELECTS => { # The fields from fielddefs that are blocked from non-timetracking users. # work_time is sometimes called actual_time. use constant TIMETRACKING_FIELDS => - qw(estimated_time remaining_time work_time actual_time - percentage_complete deadline); + qw(estimated_time remaining_time work_time actual_time percentage_complete); # The maximum number of days a token will remain valid. use constant MAX_TOKEN_AGE => 3; diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 3d09def65..401d2f2af 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -1475,9 +1475,8 @@ sub _special_parse_chfield { sub _special_parse_deadline { my ($self) = @_; - return if !$self->_user->is_timetracker; my $params = $self->_params; - + my $clause = new Bugzilla::Search::Clause(); if (my $from = $params->{'deadlinefrom'}) { $clause->add('deadline', 'greaterthaneq', $from); diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm index 7a29d325f..f4cb53600 100644 --- a/Bugzilla/WebService/Bug.pm +++ b/Bugzilla/WebService/Bug.pm @@ -418,7 +418,7 @@ sub search { delete $params->{WHERE}; unless (Bugzilla->user->is_timetracker) { - delete $params->{$_} foreach qw(estimated_time remaining_time deadline); + delete $params->{$_} foreach TIMETRACKING_FIELDS; } # Do special search types for certain fields. @@ -851,6 +851,9 @@ sub _bug_to_hash { classification => $self->type('string', $bug->classification), component => $self->type('string', $bug->component), creation_time => $self->type('dateTime', $bug->creation_ts), + # No need to format $bug->deadline specially, because Bugzilla::Bug + # already does it for us. + deadline => $self->type('string', $bug->deadline), id => $self->type('int', $bug->bug_id), is_confirmed => $self->type('boolean', $bug->everconfirmed), last_change_time => $self->type('dateTime', $bug->delta_ts), @@ -943,9 +946,6 @@ sub _bug_to_hash { if (Bugzilla->user->is_timetracker) { $item{'estimated_time'} = $self->type('double', $bug->estimated_time); $item{'remaining_time'} = $self->type('double', $bug->remaining_time); - # No need to format $bug->deadline specially, because Bugzilla::Bug - # already does it for us. - $item{'deadline'} = $self->type('string', $bug->deadline); $item{'actual_time'} = $self->type('double', $bug->actual_time); } @@ -1782,9 +1782,6 @@ C The login name of the person who filed this bug (the reporter). C The day that this bug is due to be completed, in the format C. -If you are not in the time-tracking group, this field will not be included -in the return value. - =item C C of Cs. The ids of bugs that this bug "depends on". -- cgit v1.2.3-24-g4f1b