From 7844d8c13a81e421e5ac7a5cc564c7a83a30836b Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" Date: Tue, 14 Mar 2006 22:47:24 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20329022:=20Remove=20group=5Fname=5Fto=5Fid?= =?UTF-8?q?=20in=20favor=20of=20creating=20Group=20objects=20-=20Patch=20b?= =?UTF-8?q?y=20R=C3=A9mi=20Zara=20=20r=3DLpSolit=20a?= =?UTF-8?q?=3Djustdave?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.0.0.236/trunk@192365 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/Bugzilla/Group.pm | 26 --------------------- mozilla/webtools/bugzilla/editgroups.cgi | 2 +- mozilla/webtools/bugzilla/editproducts.cgi | 4 ++-- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/mozilla/webtools/bugzilla/Bugzilla/Group.pm b/mozilla/webtools/bugzilla/Bugzilla/Group.pm index b561f004038..31b031381b5 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Group.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/Group.pm @@ -25,11 +25,6 @@ use strict; package Bugzilla::Group; -use base qw(Exporter); -@Bugzilla::Group::EXPORT = qw( - group_name_to_id -); - use Bugzilla::Config; use Bugzilla::Util; use Bugzilla::Error; @@ -145,14 +140,6 @@ sub get_all_groups { return @groups; } -sub group_name_to_id { - my ($name) = @_; - trick_taint($name); - my ($id) = Bugzilla->dbh->selectrow_array( - "SELECT id FROM groups WHERE name = ?", undef, $name); - return $id; -} - 1; __END__ @@ -177,7 +164,6 @@ Bugzilla::Group - Bugzilla group class. my $group_id = Bugzilla::Group::ValidateGroupName('admin', @users); my @groups = Bugzilla::Group::get_all_groups(); - my $group_id = group_name_to_id('admin'); =head1 DESCRIPTION @@ -227,18 +213,6 @@ Group.pm represents a Bugzilla Group object. Returns: An array of group objects. -=item C - - Description: Converts a group name to an id. - In general, instead of using this function, you should - create a Group object and get its name. This function - does not offer any real performance advantage. - - Params: $name - The name of a group. - - Returns: The numeric id of the group with that name, - or C if the group does not exist. - =back =cut diff --git a/mozilla/webtools/bugzilla/editgroups.cgi b/mozilla/webtools/bugzilla/editgroups.cgi index a2b33b3f974..d28d95f19f9 100755 --- a/mozilla/webtools/bugzilla/editgroups.cgi +++ b/mozilla/webtools/bugzilla/editgroups.cgi @@ -294,7 +294,7 @@ if ($action eq 'new') { undef, ($name, $desc, $regexp, $isactive)); my $gid = $dbh->bz_last_key('groups', 'id'); - my $admin = group_name_to_id('admin'); + my $admin = Bugzilla::Group->new({name => 'admin'})->id(); # Since we created a new group, give the "admin" group all privileges # initially. my $sth = $dbh->prepare('INSERT INTO group_group_map diff --git a/mozilla/webtools/bugzilla/editproducts.cgi b/mozilla/webtools/bugzilla/editproducts.cgi index 68e6bd42add..30b3d32a6ee 100755 --- a/mozilla/webtools/bugzilla/editproducts.cgi +++ b/mozilla/webtools/bugzilla/editproducts.cgi @@ -235,7 +235,7 @@ if ($action eq 'new') { if (Param("makeproductgroups")) { # Next we insert into the groups table my $productgroup = $product->name; - while (group_name_to_id($productgroup)) { + while (new Bugzilla::Group({name => $productgroup})) { $productgroup .= '_'; } my $group_description = "Access to bugs in the " . @@ -250,7 +250,7 @@ if ($action eq 'new') { # If we created a new group, give the "admin" group priviledges # initially. - my $admin = group_name_to_id('admin'); + my $admin = Bugzilla::Group->new({name => 'admin'})->id(); my $sth = $dbh->prepare('INSERT INTO group_group_map (member_id, grantor_id, grant_type)