From cc73e8e4f6726abd0421c78445b18bd21b28169e Mon Sep 17 00:00:00 2001 From: "erik%dasbistro.com" <> Date: Sat, 19 Feb 2005 06:41:09 +0000 Subject: Bug 253721: Add group-based lists to whining Patch by Erik Stambaugh r=joel, r,a=justdave --- Bugzilla/Search.pm | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'Bugzilla/Search.pm') diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 816b4b0a1..e58278f48 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -40,6 +40,7 @@ use Bugzilla::Config; use Bugzilla::Error; use Bugzilla::Util; use Bugzilla::Constants; +use Bugzilla::Group; use Date::Format; use Date::Parse; @@ -382,7 +383,7 @@ sub init { ( "^(?:assigned_to|reporter|qa_contact),(?:notequals|equals|anyexact),%group\\.(\\w+)%" => sub { my $group = $1; - my $groupid = ValidateGroupName( $group, ($user)); + my $groupid = Bugzilla::Group::ValidateGroupName( $group, ($user)); $groupid || ThrowUserError('invalid_group_name',{name => $group}); my @childgroups = @{$user->flatten_group_membership($groupid)}; my $table = "user_group_map_$chartid"; @@ -419,7 +420,7 @@ sub init { "^(?:cc),(?:notequals|equals|anyexact),%group\\.(\\w+)%" => sub { my $group = $1; - my $groupid = ValidateGroupName( $group, ($user)); + my $groupid = Bugzilla::Group::ValidateGroupName( $group, ($user)); $groupid || ThrowUserError('invalid_group_name',{name => $group}); my @childgroups = @{$user->flatten_group_membership($groupid)}; my $chartseq = $chartid; @@ -1495,24 +1496,6 @@ sub pronoun { return 0; } -# ValidateGroupName checks to see if ANY of the users in the provided list -# of user objects can see the named group. It returns the group id if -# successful and undef otherwise. -sub ValidateGroupName { - my ($name, @users) = (@_); - my @visible = (-1); - foreach my $user (@users) { - $user && push @visible, @{$user->visible_groups_direct}; - } - my $visible = join(', ', @visible); - my $dbh = Bugzilla->dbh; - my $sth = $dbh->prepare("SELECT id FROM groups " . - "WHERE name = ? AND id IN($visible)"); - $sth->execute($name); - my ($ret) = $sth->fetchrow_array(); - return $ret; -} - # Validate that the query type is one we can deal with sub IsValidQueryType { -- cgit v1.2.3-24-g4f1b