summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Bug.pm
diff options
context:
space:
mode:
authorRobert Webb <rowebb@gmail.com>2011-09-01 22:24:27 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2011-09-01 22:24:27 +0200
commit7a9a4fdc72fa194e1921ee157ae7f79507540f1c (patch)
treefa37bf8cc697f8c9c9e0169885a5fa8389f9e713 /Bugzilla/Bug.pm
parent4055a481342339a5665df5b2ddb2f6843c66c368 (diff)
downloadbugzilla-7a9a4fdc72fa194e1921ee157ae7f79507540f1c.tar.gz
bugzilla-7a9a4fdc72fa194e1921ee157ae7f79507540f1c.tar.xz
Bug 683025 - Add a check_for_edit to Bugzilla::Bug to return the bug object
if the user can edit the bug r=mkanat, a=mkanat
Diffstat (limited to 'Bugzilla/Bug.pm')
-rw-r--r--Bugzilla/Bug.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 7745a9809..23e07979f 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -403,6 +403,16 @@ sub check {
return $self;
}
+sub check_for_edit {
+ my $class = shift;
+ my $bug = $class->check(@_);
+
+ Bugzilla->user->can_edit_product($bug->product_id)
+ || ThrowUserError("product_edit_denied", { product => $bug->product });
+
+ return $bug;
+}
+
sub check_is_visible {
my $self = shift;
my $user = Bugzilla->user;