summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-09-09 08:40:08 +0200
committerlpsolit%gmail.com <>2005-09-09 08:40:08 +0200
commitfe43c2dcdfc844fce2c699887cf1ddae53c24b4b (patch)
treef408f23e06038177f44a3f10eef60c36f2df62c1 /Bugzilla
parent2ba75b4b9aaaeb33bee72893622f2833dd47d6c1 (diff)
downloadbugzilla-fe43c2dcdfc844fce2c699887cf1ddae53c24b4b.tar.gz
bugzilla-fe43c2dcdfc844fce2c699887cf1ddae53c24b4b.tar.xz
Bug 256135: Parameter 'movers' is handled differently in Bug.pm and buglist.cgi - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=myk
Diffstat (limited to 'Bugzilla')
-rwxr-xr-xBugzilla/Bug.pm19
-rw-r--r--Bugzilla/User.pm19
2 files changed, 27 insertions, 11 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 3a80f4095..b9206b9a0 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -599,9 +599,8 @@ sub user {
return $self->{'user'} if exists $self->{'user'};
return {} if $self->{'error'};
- my @movers = map { trim $_ } split(",", Param("movers"));
- my $canmove = Param("move-enabled") && Bugzilla->user->id &&
- (lsearch(\@movers, Bugzilla->user->login) != -1);
+ my $user = Bugzilla->user;
+ my $canmove = Param('move-enabled') && $user->is_mover;
# In the below, if the person hasn't logged in, then we treat them
# as if they can do anything. That's because we don't know why they
@@ -609,17 +608,17 @@ sub user {
# Display everything as if they have all the permissions in the
# world; their permissions will get checked when they log in and
# actually try to make the change.
- my $unknown_privileges = !Bugzilla->user->id
- || Bugzilla->user->in_group("editbugs");
+ my $unknown_privileges = !$user->id
+ || $user->in_group("editbugs");
my $canedit = $unknown_privileges
- || Bugzilla->user->id == $self->{assigned_to_id}
+ || $user->id == $self->{assigned_to_id}
|| (Param('useqacontact')
&& $self->{'qa_contact_id'}
- && Bugzilla->user->id == $self->{qa_contact_id});
+ && $user->id == $self->{qa_contact_id});
my $canconfirm = $unknown_privileges
- || Bugzilla->user->in_group("canconfirm");
- my $isreporter = Bugzilla->user->id
- && Bugzilla->user->id == $self->{reporter_id};
+ || $user->in_group("canconfirm");
+ my $isreporter = $user->id
+ && $user->id == $self->{reporter_id};
$self->{'user'} = {canmove => $canmove,
canconfirm => $canconfirm,
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 024645eaf..8d31414ba 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -1102,7 +1102,18 @@ sub wants_mail {
return defined($wants_mail) ? 1 : 0;
}
-
+
+sub is_mover {
+ my $self = shift;
+
+ if (!defined $self->{'is_mover'}) {
+ my @movers = map { trim($_) } split(',', Param('movers'));
+ $self->{'is_mover'} = ($self->id
+ && lsearch(\@movers, $self->login) != -1);
+ }
+ return $self->{'is_mover'};
+}
+
sub get_userlist {
my $self = shift;
@@ -1565,6 +1576,12 @@ Returns true if the user wants mail for a given set of events. This method is
more general than C<wants_bug_mail>, allowing you to check e.g. permissions
for flag mail.
+=item C<is_mover>
+
+Returns true if the user is in the list of users allowed to move bugs
+to another database. Note that this method doesn't check whether bug
+moving is enabled.
+
=back
=head1 CLASS FUNCTIONS