summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-06-25 21:10:28 +0200
committerlpsolit%gmail.com <>2005-06-25 21:10:28 +0200
commit951c040a0968a02740464e359a9bfd3c75a0e4cc (patch)
tree3ce61a16ecd251e5b042aca5d0c1183e67df3e48
parent05cc6289d00b21e12d4d59282384b8729a5c2b57 (diff)
downloadbugzilla-951c040a0968a02740464e359a9bfd3c75a0e4cc.tar.gz
bugzilla-951c040a0968a02740464e359a9bfd3c75a0e4cc.tar.xz
Bug 277454: Bugs in inactivated groups don't show padlocks on the buglist - Patch by Marc Schumann <wurblzap@gmail.com> r=LpSolit a=justdave
-rwxr-xr-xbuglist.cgi10
-rwxr-xr-xchecksetup.pl2
-rwxr-xr-xsanitycheck.cgi90
3 files changed, 89 insertions, 13 deletions
diff --git a/buglist.cgi b/buglist.cgi
index 3070fbcec..65b0c4e2b 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -894,16 +894,16 @@ if (@bugidlist) {
$dbh->sql_group_by('bugs.bug_id'));
$sth->execute();
while (my ($bug_id, $min_membercontrol) = $sth->fetchrow_array()) {
- $min_membercontrol{$bug_id} = $min_membercontrol;
+ $min_membercontrol{$bug_id} = $min_membercontrol || CONTROLMAPNA;
}
foreach my $bug (@bugs) {
next unless defined($min_membercontrol{$bug->{'bug_id'}});
- if ($min_membercontrol{$bug->{'bug_id'}} == CONTROLMAPSHOWN
- || $min_membercontrol{$bug->{'bug_id'}} == CONTROLMAPDEFAULT) {
- $bug->{'secure_mode'} = 'manual';
- } elsif ($min_membercontrol{$bug->{'bug_id'}} == CONTROLMAPMANDATORY) {
+ if ($min_membercontrol{$bug->{'bug_id'}} == CONTROLMAPMANDATORY) {
$bug->{'secure_mode'} = 'implied';
}
+ else {
+ $bug->{'secure_mode'} = 'manual';
+ }
}
}
diff --git a/checksetup.pl b/checksetup.pl
index 4cfc096e1..61df2c688 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -3314,7 +3314,7 @@ if ($mapcnt == 0) {
# First, get all the existing products and their groups.
$sth = $dbh->prepare("SELECT groups.id, products.id, groups.name, " .
"products.name FROM groups, products " .
- "WHERE isbuggroup != 0 AND isactive != 0");
+ "WHERE isbuggroup != 0");
$sth->execute();
while (my ($groupid, $productid, $groupname, $productname)
= $sth->fetchrow_array()) {
diff --git a/sanitycheck.cgi b/sanitycheck.cgi
index 7b5db7ad3..79295b3c8 100755
--- a/sanitycheck.cgi
+++ b/sanitycheck.cgi
@@ -21,6 +21,7 @@
# Contributor(s): Terry Weissman <terry@mozilla.org>
# Matthew Tuck <matty@chariot.net.au>
# Max Kanat-Alexander <mkanat@bugzilla.org>
+# Marc Schumann <wurblzap@gmail.com>
use strict;
@@ -176,6 +177,75 @@ if (defined $cgi->param('cleangroupsnow')) {
}
###########################################################################
+# Create missing group_control_map entries
+###########################################################################
+
+if (defined $cgi->param('createmissinggroupcontrolmapentries')) {
+ Status(qq{OK, now creating <code>SHOWN</code> member control entries
+ for product/group combinations lacking one.});
+
+ 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
+ )});
+ my $updatesth = $dbh->prepare(qq{UPDATE group_control_map
+ SET membercontrol = $shown
+ WHERE group_id = ?
+ AND product_id = ?});
+ my $counter = 0;
+
+ # Find all group/product combinations used for bugs but not set up
+ # correctly in group_control_map
+ my $invalid_combinations = $dbh->selectall_arrayref(
+ qq{ SELECT bugs.product_id,
+ bgm.group_id,
+ gcm.membercontrol,
+ groups.name,
+ products.name
+ FROM bugs
+ INNER JOIN bug_group_map AS bgm
+ ON bugs.bug_id = bgm.bug_id
+ INNER JOIN groups
+ ON bgm.group_id = groups.id
+ INNER JOIN products
+ ON bugs.product_id = products.id
+ LEFT JOIN group_control_map AS gcm
+ ON bugs.product_id = gcm.product_id
+ AND bgm.group_id = gcm.group_id
+ WHERE COALESCE(gcm.membercontrol, $na) = $na
+ } . $dbh->sql_group_by('bugs.product_id, bgm.group_id'));
+
+ foreach (@$invalid_combinations) {
+ my ($product_id, $group_id, $currentmembercontrol,
+ $group_name, $product_name) = @$_;
+
+ $counter++;
+ if (defined($currentmembercontrol)) {
+ Status(qq{Updating <code>NA/<em>xxx</em></code> group control
+ setting for group <em>$group_name</em> to
+ <code>SHOWN/<em>xxx</em></code> in product
+ <em>$product_name</em>.});
+ $updatesth->execute($group_id, $product_id);
+ }
+ else {
+ Status(qq{Generating <code>SHOWN/NA</code> group control setting
+ for group <em>$group_name</em> in product
+ <em>$product_name</em>.});
+ $insertsth->execute($group_id, $product_id);
+ }
+ }
+
+ Status("Repaired $counter defective group control settings.");
+}
+
+###########################################################################
# Send unsent mail
###########################################################################
@@ -656,8 +726,8 @@ if (defined $cgi->param('rebuildkeywordcache')) {
# General bug checks
###########################################################################
-sub BugCheck ($$) {
- my ($middlesql, $errortext) = @_;
+sub BugCheck ($$;$$) {
+ my ($middlesql, $errortext, $repairparam, $repairtext) = @_;
SendSQL("SELECT DISTINCT bugs.bug_id " .
"FROM $middlesql " .
@@ -672,6 +742,11 @@ sub BugCheck ($$) {
if (@badbugs) {
Alert("$errortext: " . BugListLinks(@badbugs));
+ if ($repairparam) {
+ $repairtext ||= 'Repair these bugs';
+ print qq{<a href="sanitycheck.cgi?$repairparam=1">$repairtext</a>.},
+ '<p>';
+ }
}
}
@@ -763,10 +838,12 @@ BugCheck("bugs
LEFT JOIN group_control_map
ON bugs.product_id = group_control_map.product_id
AND bug_group_map.group_id = group_control_map.group_id
- WHERE groups.isactive != 0
- AND ((group_control_map.membercontrol = " . CONTROLMAPNA . ")
+ WHERE ((group_control_map.membercontrol = " . CONTROLMAPNA . ")
OR (group_control_map.membercontrol IS NULL))",
- "Have groups not permitted for their products");
+ 'Have groups not permitted for their products',
+ 'createmissinggroupcontrolmapentries',
+ 'Permit the missing groups for the affected products
+ (set member control to <code>SHOWN</code>)');
BugCheck("bugs
INNER JOIN bug_group_map
@@ -776,8 +853,7 @@ BugCheck("bugs
LEFT JOIN group_control_map
ON bugs.product_id = group_control_map.product_id
AND bug_group_map.group_id = group_control_map.group_id
- WHERE groups.isactive != 0
- AND group_control_map.membercontrol = " . CONTROLMAPMANDATORY . "
+ WHERE group_control_map.membercontrol = " . CONTROLMAPMANDATORY . "
AND bug_group_map.group_id IS NULL",
"Are missing groups required for their products");