diff options
author | 2015-12-02 13:51:39 +0100 | |
---|---|---|
committer | 2015-12-02 13:51:39 +0100 | |
commit | 947f2948bc03db13a3be41118c4c2a4265ca6b2a (patch) | |
tree | 3be0d6da97aa04e0c8016302300cfa745cda0f97 | |
parent | Back out bug 1138463 - data/assets/.htaccess must be fixed too (diff) | |
download | bugzilla-947f2948bc03db13a3be41118c4c2a4265ca6b2a.tar.gz bugzilla-947f2948bc03db13a3be41118c4c2a4265ca6b2a.tar.bz2 bugzilla-947f2948bc03db13a3be41118c4c2a4265ca6b2a.zip |
Bug 1219276: Creating a new group fails if a custom extension adds entries to group_control_map and "insertnew" is selected
r=LpSolit a=dkl
-rw-r--r-- | Bugzilla/Group.pm | 16 | ||||
-rwxr-xr-x | editgroups.cgi | 8 |
2 files changed, 15 insertions, 9 deletions
diff --git a/Bugzilla/Group.pm b/Bugzilla/Group.pm index 07b78e366..f7a50f7f1 100644 --- a/Bugzilla/Group.pm +++ b/Bugzilla/Group.pm @@ -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)> diff --git a/editgroups.cgi b/editgroups.cgi index 287ac1114..35989b954 100755 --- a/editgroups.cgi +++ b/editgroups.cgi @@ -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 makeproductgroups. - 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'; |