Closed Bug 323240 Opened 19 years ago Closed 18 years ago

Bugzilla::Bug.pm needs a way to add a bug to groups, and post_bug.cgi should use it

Categories

(Bugzilla :: Creating/Changing Bugs, enhancement)

2.21
enhancement
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 351332

People

(Reporter: mkanat, Assigned: batosti)

References

Details

Attachments

(1 file, 1 obsolete file)

Bugzilla::Bug needs a way to add a bug to a group, probably just to a single one. We can just call the function over and over to add the bug to multiple groups.

Ideally it would take a Bugzilla::Group object as an argument, if we have that.

We may also want to have a Bugzilla::Product function that returns the correct mandatory Bugzilla::Group objects for a bug being newly-filed in that product, to help out with this, but I'm not sure.
Attached patch batosti_v1 (obsolete) — Splinter Review
Assignee: create-and-change → batosti
Status: NEW → ASSIGNED
Attachment #216774 - Flags: review?(mkanat)
Comment on attachment 216774 [details] [diff] [review]
batosti_v1

>Index: Bugzilla/Bug.pm

>+sub add_groups {
>+    foreach my $group (@$groups) { 
>+        $dbh->do(q{INSERT INTO bug_group_map (bug_id, group_id)
>+                 VALUES (?, ?)}, undef, $self->bug_id, $group->id);
>+    }

Prepare the SQL query outside the FOREACH loop.


>+sub check_groups {
>+    foreach my $group (@$groups) {
>+            my $othercontrol = 
>+               $dbh->selectrow_array("SELECT othercontrol 
>+                                     FROM group_control_map
>+                                     WHERE group_id = ? AND 
>+                                           product_id = ?",
>+                                     undef, $group->id, 
>+                                     $product_id);

Same comment here.
Attached patch batosti_v1_fixSplinter Review
Attachment #216774 - Attachment is obsolete: true
Attachment #217477 - Flags: review?(mkanat)
Attachment #216774 - Flags: review?(mkanat)
Comment on attachment 217477 [details] [diff] [review]
batosti_v1_fix

I haven't looked over the code very much, but I can assure you that this regresses a security fix. The bug has to be in groups *before* we set creation_ts.

I'm not quite sure how we want to do that. Any ideas?
Attachment #217477 - Flags: review?(mkanat) → review-
For the record, mkanat is talking about bug 292544.
(In reply to comment #4)
> I'm not quite sure how we want to do that. Any ideas?

I see no reason to delay the call to $bug->add_groups($groupstoadd) that far in the code. Simply call it where we originally inserted entries in bug_group_map. In all cases, this must happen while tables are locked and before creation_ts is set.
dupe of bug 351332?

*** This bug has been marked as a duplicate of 351332 ***
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
Target Milestone: Bugzilla 3.0 → ---
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: