summaryrefslogtreecommitdiffstats
path: root/post_bug.cgi
diff options
context:
space:
mode:
authorbugreport%peshkin.net <>2002-11-25 04:56:17 +0100
committerbugreport%peshkin.net <>2002-11-25 04:56:17 +0100
commitc64d51111a5ae02d6fc45163a847d0b7e2004548 (patch)
treefd7a0cb912e4411573faa5305df4d4971a3b6dda /post_bug.cgi
parente7720dcdd4e332c096a310c53412d3acaacd381e (diff)
downloadbugzilla-c64d51111a5ae02d6fc45163a847d0b7e2004548.tar.gz
bugzilla-c64d51111a5ae02d6fc45163a847d0b7e2004548.tar.xz
Bug 147275 Rearchitect product groups
Patch by joel r=bbaetz,justdave a=justdave
Diffstat (limited to 'post_bug.cgi')
-rwxr-xr-xpost_bug.cgi35
1 files changed, 30 insertions, 5 deletions
diff --git a/post_bug.cgi b/post_bug.cgi
index 4cacb271c..3ddfbe689 100755
--- a/post_bug.cgi
+++ b/post_bug.cgi
@@ -26,6 +26,7 @@
use strict;
use lib qw(.);
+use Bugzilla::Constants;
require "CGI.pl";
require "bug_form.pl";
@@ -101,9 +102,8 @@ if (defined $::FORM{'maketemplate'}) {
umask 0;
# Some sanity checking
-if(Param("usebuggroupsentry") && GroupExists($product)) {
- UserInGroup($product) ||
- ThrowUserError("entry_access_denied", {product => $product});
+if (!CanEnterProduct($product)) {
+ ThrowUserError("entry_access_denied", {product => $product});
}
my $component_id = get_component_id($product_id, $::FORM{component});
@@ -363,13 +363,38 @@ foreach my $b (grep(/^bit-\d*$/, keys %::FORM)) {
WHERE user_id = $::userid
AND group_id = $v
AND isbless = 0");
- my ($member) = FetchSQLData();
- if ($member) {
+ my ($permit) = FetchSQLData();
+ if (!$permit) {
+ SendSQL("SELECT othercontrol FROM group_control_map
+ WHERE group_id = $v AND product_id = $product_id");
+ my ($othercontrol) = FetchSQLData();
+ $permit = (($othercontrol == CONTROLMAPSHOWN)
+ || ($othercontrol == CONTROLMAPDEFAULT));
+ }
+ if ($permit) {
push(@groupstoadd, $v)
}
}
}
+SendSQL("SELECT DISTINCT groups.id, groups.name, " .
+ "membercontrol, othercontrol " .
+ "FROM groups LEFT JOIN group_control_map " .
+ "ON group_id = id AND product_id = $product_id " .
+ " WHERE isbuggroup != 0 AND isactive != 0 ORDER BY description");
+while (MoreSQLData()) {
+ my ($id, $groupname, $membercontrol, $othercontrol ) = FetchSQLData();
+ $membercontrol ||= 0;
+ $othercontrol ||= 0;
+ # Add groups required
+ if (($membercontrol == CONTROLMAPMANDATORY)
+ || (($othercontrol == CONTROLMAPMANDATORY)
+ && (!UserInGroup($groupname)))) {
+ # User had no option, bug needs to be in this group.
+ push(@groupstoadd, $id)
+ }
+}
+
# Lock tables before inserting records for the new bug into the database
# if we are using a shadow database to prevent shadow database corruption