Commit d8dc06a6 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 478972: Remove the 'useentrygroupdefault' parameter - Patch by Fré©ric…

Bug 478972: Remove the 'useentrygroupdefault' parameter - Patch by Fré©ric Buclin <LpSolit@gmail.com> r/a=mkanat
parent a86ee3a1
......@@ -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'}) {
......
......@@ -49,12 +49,6 @@ sub get_param_list {
},
{
name => 'useentrygroupdefault',
type => 'b',
default => 0
},
{
name => 'chartgroup',
type => 's',
choices => \&_get_all_group_names,
......
......@@ -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,
......
......@@ -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));
}
}
}
......
......@@ -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 {
......
......@@ -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";
......
......@@ -481,25 +481,6 @@
<varlistentry>
<term>
useentrygroupdefault
</term>
<listitem>
<para>
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 <quote>on</quote>, 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.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
usevisibilitygroups
</term>
<listitem>
......
......@@ -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);
......
......@@ -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 = ?
......
......@@ -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 " _
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment