]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 413439: Enable "change several bugs at once" if the user has editbugs OR product...
authorlpsolit%gmail.com <>
Tue, 18 Mar 2008 14:21:24 +0000 (14:21 +0000)
committerlpsolit%gmail.com <>
Tue, 18 Mar 2008 14:21:24 +0000 (14:21 +0000)
buglist.cgi
template/en/default/global/user-error.html.tmpl

index 670844bb9502e5a21c0534433b81a2204c6cc811..43d147b82d7bfa52997c54f3970656e04af6301c 100755 (executable)
@@ -94,10 +94,6 @@ my $dotweak = $cgi->param('tweak') ? 1 : 0;
 # Log the user in
 if ($dotweak) {
     Bugzilla->login(LOGIN_REQUIRED);
-    Bugzilla->user->in_group("editbugs")
-      || ThrowUserError("auth_failure", {group  => "editbugs",
-                                         action => "modify",
-                                         object => "multiple_bugs"});
 }
 
 # Hack to support legacy applications that think the RDF ctype is at format=rdf.
@@ -373,6 +369,22 @@ sub GetGroups {
     return [values %legal_groups];
 }
 
+sub _close_standby_message {
+    my ($contenttype, $disposition, $serverpush) = @_;
+    my $cgi = Bugzilla->cgi;
+
+    # Close the "please wait" page, then open the buglist page
+    if ($serverpush) {
+        print $cgi->multipart_end();
+        print $cgi->multipart_start(-type                => $contenttype,
+                                    -content_disposition => $disposition);
+    }
+    else {
+        print $cgi->header(-type                => $contenttype,
+                           -content_disposition => $disposition);
+    }
+}
+
 
 ################################################################################
 # Command Execution
@@ -1125,7 +1137,17 @@ $vars->{'urlquerypart'} = $params->canonicalise_query('order',
                                                       'cmdtype',
                                                       'query_based_on');
 $vars->{'order'} = $order;
-$vars->{'caneditbugs'} = Bugzilla->user->in_group('editbugs');
+$vars->{'caneditbugs'} = 1;
+
+if (!Bugzilla->user->in_group('editbugs')) {
+    foreach my $product (keys %$bugproducts) {
+        my $prod = new Bugzilla::Product({name => $product});
+        if (!Bugzilla->user->in_group('editbugs', $prod->id)) {
+            $vars->{'caneditbugs'} = 0;
+            last;
+        }
+    }
+}
 
 my @bugowners = keys %$bugowners;
 if (scalar(@bugowners) > 1 && Bugzilla->user->in_group('editbugs')) {
@@ -1144,6 +1166,12 @@ $vars->{'currenttime'} = time();
 
 # The following variables are used when the user is making changes to multiple bugs.
 if ($dotweak && scalar @bugs) {
+    if (!$vars->{'caneditbugs'}) {
+        _close_standby_message('text/html', 'inline', $serverpush);
+        ThrowUserError('auth_failure', {group  => 'editbugs',
+                                        action => 'modify',
+                                        object => 'multiple_bugs'});
+    }
     $vars->{'dotweak'} = 1;
     $vars->{'valid_keywords'} = [map($_->name, Bugzilla::Keyword->get_all)];
     $vars->{'use_keywords'} = 1 if Bugzilla::Keyword::keyword_count();
@@ -1249,17 +1277,7 @@ if ($format->{'extension'} eq "csv") {
 # Suggest a name for the bug list if the user wants to save it as a file.
 $disposition .= "; filename=\"$filename\"";
 
-if ($serverpush) {
-    # Close the "please wait" page, then open the buglist page
-    print $cgi->multipart_end();
-    print $cgi->multipart_start(-type                => $contenttype,
-                                -content_disposition => $disposition);
-}
-else {
-    print $cgi->header(-type                => $contenttype,
-                       -content_disposition => $disposition);
-}
-
+_close_standby_message($contenttype, $disposition, $serverpush);
 
 ################################################################################
 # Content Generation
index 8b3b5e20e22faf486c01a682914400d088132410..bbd187a88650ccdb2811898dcde127b112e623fd 100644 (file)
   [% ELSIF error == "fieldvalue_still_has_bugs" %]
     [% title = "You Cannot Delete This Field Value" %]
     You cannot delete the value '[% value FILTER html %]' from the 
-    '[% field FILTER html%]' field, because there are still
+    '[% field FILTER html %]' field, because there are still
     [%+ count FILTER html %] [%+ terms.bugs %] using it.
 
   [% ELSIF error == "fieldvalue_undefined" %]