From d8dc06a626ad4542d9d5db9c5e2a2de7f4003cc6 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Tue, 31 Mar 2009 19:16:13 +0000 Subject: Bug 478972: Remove the 'useentrygroupdefault' parameter - Patch by Frédéric Buclin r/a=mkanat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/Config.pm | 4 ---- Bugzilla/Config/GroupSecurity.pm | 6 ------ Bugzilla/DB/Schema.pm | 6 ++++-- Bugzilla/Install/DB.pm | 25 +++++++++++----------- Bugzilla/Product.pm | 7 +++--- Bugzilla/User.pm | 10 +++------ docs/en/xml/administration.xml | 19 ---------------- editgroups.cgi | 5 ++--- sanitycheck.cgi | 12 ++++------- .../default/admin/params/groupsecurity.html.tmpl | 6 ------ 10 files changed, 29 insertions(+), 71 deletions(-) diff --git a/Bugzilla/Config.pm b/Bugzilla/Config.pm index 14f10bed9..4074abcd1 100644 --- a/Bugzilla/Config.pm +++ b/Bugzilla/Config.pm @@ -151,10 +151,6 @@ sub update_params { { $param->{'makeproductgroups'} = $param->{'usebuggroups'}; } - if (exists $param->{'usebuggroupsentry'} - && !exists $param->{'useentrygroupdefault'}) { - $param->{'useentrygroupdefault'} = $param->{'usebuggroupsentry'}; - } # Modularise auth code if (exists $param->{'useLDAP'} && !exists $param->{'loginmethod'}) { diff --git a/Bugzilla/Config/GroupSecurity.pm b/Bugzilla/Config/GroupSecurity.pm index 0a238f209..f0038f153 100644 --- a/Bugzilla/Config/GroupSecurity.pm +++ b/Bugzilla/Config/GroupSecurity.pm @@ -48,12 +48,6 @@ sub get_param_list { default => 0 }, - { - name => 'useentrygroupdefault', - type => 'b', - default => 0 - }, - { name => 'chartgroup', type => 's', diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm index 680f754ca..1afdb6598 100644 --- a/Bugzilla/DB/Schema.pm +++ b/Bugzilla/DB/Schema.pm @@ -1010,10 +1010,12 @@ use constant ABSTRACT_SCHEMA => { REFERENCES => {TABLE => 'products', COLUMN => 'id', DELETE => 'CASCADE'}}, - entry => {TYPE => 'BOOLEAN', NOTNULL => 1}, + entry => {TYPE => 'BOOLEAN', NOTNULL => 1, + DEFAULT => 'FALSE'}, membercontrol => {TYPE => 'BOOLEAN', NOTNULL => 1}, othercontrol => {TYPE => 'BOOLEAN', NOTNULL => 1}, - canedit => {TYPE => 'BOOLEAN', NOTNULL => 1}, + canedit => {TYPE => 'BOOLEAN', NOTNULL => 1, + DEFAULT => 'FALSE'}, editcomponents => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'FALSE'}, editbugs => {TYPE => 'BOOLEAN', NOTNULL => 1, diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm index ec6c8ce9c..de1d48361 100644 --- a/Bugzilla/Install/DB.pm +++ b/Bugzilla/Install/DB.pm @@ -557,7 +557,13 @@ sub update_table_definitions { # 2009-03-02 arbingersys@gmail.com - Bug 423613 $dbh->bz_add_index('profiles', 'profiles_extern_id_idx', {TYPE => 'UNIQUE', FIELDS => [qw(extern_id)]}); - + + # 2009-03-31 LpSolit@gmail.com - Bug 478972 + $dbh->bz_alter_column('group_control_map', 'entry', + {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'FALSE'}); + $dbh->bz_alter_column('group_control_map', 'canedit', + {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'FALSE'}); + ################################################################ # New --TABLE-- changes should go *** A B O V E *** this point # ################################################################ @@ -1840,7 +1846,6 @@ sub _setup_usebuggroups_backward_compatibility { # # If group_control_map is empty, backward-compatibility # usebuggroups-equivalent records should be created. - my $entry = Bugzilla->params->{'useentrygroupdefault'}; my ($maps_exist) = $dbh->selectrow_array( "SELECT DISTINCT 1 FROM group_control_map"); if (!$maps_exist) { @@ -1857,11 +1862,9 @@ sub _setup_usebuggroups_backward_compatibility { if ($groupname eq $productname) { # Product and group have same name. $dbh->do("INSERT INTO group_control_map " . - "(group_id, product_id, entry, membercontrol, " . - "othercontrol, canedit) " . - "VALUES ($groupid, $productid, $entry, " . - CONTROLMAPDEFAULT . ", " . - CONTROLMAPNA . ", 0)"); + "(group_id, product_id, membercontrol, othercontrol) " . + "VALUES (?, ?, ?, ?)", undef, + ($groupid, $productid, CONTROLMAPDEFAULT, CONTROLMAPNA)); } else { # See if this group is a product group at all. my $sth2 = $dbh->prepare("SELECT id FROM products @@ -1872,11 +1875,9 @@ sub _setup_usebuggroups_backward_compatibility { # If there is no product with the same name as this # group, then it is permitted for all products. $dbh->do("INSERT INTO group_control_map " . - "(group_id, product_id, entry, membercontrol, " . - "othercontrol, canedit) " . - "VALUES ($groupid, $productid, 0, " . - CONTROLMAPSHOWN . ", " . - CONTROLMAPNA . ", 0)"); + "(group_id, product_id, membercontrol, othercontrol) " . + "VALUES (?, ?, ?, ?)", undef, + ($groupid, $productid, CONTROLMAPSHOWN, CONTROLMAPNA)); } } } diff --git a/Bugzilla/Product.pm b/Bugzilla/Product.pm index 88292d27e..03ebe2639 100644 --- a/Bugzilla/Product.pm +++ b/Bugzilla/Product.pm @@ -565,10 +565,9 @@ sub _create_bug_group { # Associate the new group and new product. $dbh->do('INSERT INTO group_control_map - (group_id, product_id, entry, membercontrol, othercontrol, canedit) - VALUES (?, ?, ?, ?, ?, ?)', - undef, ($group->id, $self->id, Bugzilla->params->{'useentrygroupdefault'}, - CONTROLMAPDEFAULT, CONTROLMAPNA, 0)); + (group_id, product_id, membercontrol, othercontrol) + VALUES (?, ?, ?, ?)', + undef, ($group->id, $self->id, CONTROLMAPDEFAULT, CONTROLMAPNA)); } sub _create_series { diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index fe04856aa..d373f019d 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -658,13 +658,9 @@ sub get_selectable_products { my $query = "SELECT id " . " FROM products " . "LEFT JOIN group_control_map " . - " ON group_control_map.product_id = products.id "; - if (Bugzilla->params->{'useentrygroupdefault'}) { - $query .= " AND group_control_map.entry != 0 "; - } else { - $query .= " AND group_control_map.membercontrol = " . CONTROLMAPMANDATORY; - } - $query .= " AND group_id NOT IN(" . $self->groups_as_string . ") " . + "ON group_control_map.product_id = products.id " . + " AND group_control_map.membercontrol = " . CONTROLMAPMANDATORY . + " AND group_id NOT IN(" . $self->groups_as_string . ") " . " WHERE group_id IS NULL " . "ORDER BY name"; diff --git a/docs/en/xml/administration.xml b/docs/en/xml/administration.xml index df5671502..09cf36ed1 100644 --- a/docs/en/xml/administration.xml +++ b/docs/en/xml/administration.xml @@ -479,25 +479,6 @@ - - - useentrygroupdefault - - - - Bugzilla products can have a group associated with them, so that - certain users can only see bugs in certain products. When this - parameter is set to on, this - causes the initial group controls on newly created products - to place all newly-created bugs in the group - having the same name as the product immediately. - After a product is initially created, the group controls - can be further adjusted without interference by - this mechanism. - - - - usevisibilitygroups diff --git a/editgroups.cgi b/editgroups.cgi index 475b805cc..0554638fa 100755 --- a/editgroups.cgi +++ b/editgroups.cgi @@ -214,9 +214,8 @@ if ($action eq 'new') { # 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, entry, membercontrol, - othercontrol, canedit) - SELECT ?, products.id, 0, ?, ?, 0 FROM products', + (group_id, product_id, membercontrol, othercontrol) + SELECT ?, products.id, ?, ? FROM products', undef, ($group->id, CONTROLMAPSHOWN, CONTROLMAPNA)); } delete_token($token); diff --git a/sanitycheck.cgi b/sanitycheck.cgi index 93228fc67..c43641fb6 100755 --- a/sanitycheck.cgi +++ b/sanitycheck.cgi @@ -140,14 +140,10 @@ if ($cgi->param('createmissinggroupcontrolmapentries')) { my $na = CONTROLMAPNA; my $shown = CONTROLMAPSHOWN; my $insertsth = $dbh->prepare( - qq{INSERT INTO group_control_map ( - group_id, product_id, entry, - membercontrol, othercontrol, canedit - ) - VALUES ( - ?, ?, 0, - $shown, $na, 0 - )}); + qq{INSERT INTO group_control_map + (group_id, product_id, membercontrol, othercontrol) + VALUES (?, ?, $shown, $na)}); + my $updatesth = $dbh->prepare(qq{UPDATE group_control_map SET membercontrol = $shown WHERE group_id = ? diff --git a/template/en/default/admin/params/groupsecurity.html.tmpl b/template/en/default/admin/params/groupsecurity.html.tmpl index 440e1cf2f..ab39a9149 100644 --- a/template/en/default/admin/params/groupsecurity.html.tmpl +++ b/template/en/default/admin/params/groupsecurity.html.tmpl @@ -27,12 +27,6 @@ makeproductgroups => "If this is on, $terms.Bugzilla will associate $terms.abug group " _ "with each product in the database, and use it for querying ${terms.bugs}.", - useentrygroupdefault => "If this is on, $terms.Bugzilla will use product $terms.bug groups " _ - "by default to restrict who can enter ${terms.bugs}. If this is on, " _ - "users can see any product to which they have entry access in search menus. " _ - "If this is off, users can see any product to which they have not " _ - "been excluded by a mandatory restriction.", - chartgroup => "The name of the group of users who can use the 'New Charts' " _ "feature. Administrators should ensure that the public categories " _ "and series definitions do not divulge confidential information " _ -- cgit v1.2.3-24-g4f1b