]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1219276: Creating a new group fails if a custom extension adds entries to group_c...
authorAlex Schuilenburg <alex@schuilenburg.org>
Wed, 2 Dec 2015 12:50:04 +0000 (13:50 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Wed, 2 Dec 2015 12:50:04 +0000 (13:50 +0100)
r=LpSolit

Bugzilla/Group.pm
editgroups.cgi

index 07b78e3663bca3b1b8083afb2c6d7a548ae6ed18..f7a50f7f1a3b055e354a2a5bcec4f6044405c779 100644 (file)
@@ -383,6 +383,7 @@ sub create {
     my $dbh = Bugzilla->dbh;
 
     my $silently = delete $params->{silently};
+    my $use_in_all_products = delete $params->{use_in_all_products};
     if (Bugzilla->usage_mode == USAGE_MODE_CMDLINE and !$silently) {
         print get_text('install_group_create', { name => $params->{name} }),
               "\n";
@@ -406,6 +407,14 @@ sub create {
         $sth->execute($admin->id, $group->id, GROUP_VISIBLE);
     }
 
+    # Permit all existing products to use the new group if requested.
+    if ($use_in_all_products) {
+        $dbh->do('INSERT INTO group_control_map
+                  (group_id, product_id, membercontrol, othercontrol)
+                  SELECT ?, products.id, ?, ? FROM products',
+                  undef, ($group->id, CONTROLMAPSHOWN, CONTROLMAPNA));
+    }
+
     $group->_rederive_regexp() if $group->user_regexp;
 
     Bugzilla::Hook::process('group_end_of_create', { group => $group });
@@ -524,8 +533,11 @@ provides, in addition to any methods documented below.
 
 Note that in addition to what L<Bugzilla::Object/create($params)>
 normally does, this function also makes the new group be inherited
-by the C<admin> group. That is, the C<admin> group will automatically
-be a member of this group.
+by the C<admin> group and optionally inserts access controls for
+this group into all existing products. That is, the C<admin> group
+will automatically be a member of this group and bugs for all
+products may optionally be restricted to this group by group
+members.
 
 =item C<ValidateGroupName($name, @users)>
 
index e39eb6c87ca23fb77f46cb5bc624642ebd2335dc..35989b954b0384d3caa025aa37929c9360d4ea1e 100755 (executable)
@@ -194,15 +194,9 @@ if ($action eq 'new') {
         isactive    => scalar $cgi->param('isactive'),
         icon_url    => scalar $cgi->param('icon_url'),
         isbuggroup  => 1,
+        use_in_all_products => scalar $cgi->param('insertnew'),
     });
 
-    # Permit all existing products to use the new group if requested.
-    if ($cgi->param('insertnew')) {
-        $dbh->do('INSERT INTO group_control_map
-                  (group_id, product_id, membercontrol, othercontrol)
-                  SELECT ?, products.id, ?, ? FROM products',
-                  undef, ($group->id, CONTROLMAPSHOWN, CONTROLMAPNA));
-    }
     delete_token($token);
 
     $vars->{'message'} = 'group_created';