From f0fede65121748fb8b5404a0bdde3616d37eaf51 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Fri, 6 May 2011 22:42:31 +0200 Subject: Bug 653341: Bug.create() fails to error out if an invalid group is passed r/a=mkanat --- Bugzilla/Bug.pm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Bugzilla/Bug.pm') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index beafcfa8c..f3d635344 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -1641,11 +1641,14 @@ sub _check_groups { # First check all the groups they chose to set. foreach my $name (@$group_names) { - # We don't want to expose the existence or non-existence of groups, - # so instead of doing check(), we just do "next" on an invalid - # group. - my $group = new Bugzilla::Group({ name => $name }) or next; - next if !$product->group_is_settable($group); + my $group = Bugzilla::Group->check( + { name => $name, product => $product, + _error => 'group_restriction_not_allowed' }); + + if (!$product->group_is_settable($group)) { + ThrowUserError('group_restriction_not_allowed', + { name => $name, product => $product }); + } $add_groups{$group->id} = $group; } } -- cgit v1.2.3-24-g4f1b