From: lpsolit%gmail.com <> Date: Sat, 3 Dec 2005 06:07:05 +0000 (+0000) Subject: Bug 312386: checksetup.cgi fails to check for existing group_group_map for new admins... X-Git-Tag: bugzilla-2.20.1~77 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2654ddfc85eb0b97c887b04161d69d49a5876bf9;p=thirdparty%2Fbugzilla.git Bug 312386: checksetup.cgi fails to check for existing group_group_map for new admins - Patch by Joel Peshkin r=karl r=LpSolit a=justdave --- diff --git a/checksetup.pl b/checksetup.pl index 3fbad23482..04e0583c54 100755 --- a/checksetup.pl +++ b/checksetup.pl @@ -4363,12 +4363,22 @@ if ($sth->rows == 0) { # Admins get inherited membership and bless capability for all groups foreach my $group ( @groups ) { - $dbh->do("INSERT INTO group_group_map - (member_id, grantor_id, grant_type) - VALUES ($admingroupid, $group, " . GROUP_MEMBERSHIP . ")"); - $dbh->do("INSERT INTO group_group_map - (member_id, grantor_id, grant_type) - VALUES ($admingroupid, $group, " . GROUP_BLESS . ")"); + my $sth_check = $dbh->prepare("SELECT member_id FROM group_group_map + WHERE member_id = ? + AND grantor_id = ? + AND grant_type = ?"); + $sth_check->execute($admingroupid, $group, GROUP_MEMBERSHIP); + unless ($sth_check->rows) { + $dbh->do("INSERT INTO group_group_map + (member_id, grantor_id, grant_type) + VALUES ($admingroupid, $group, " . GROUP_MEMBERSHIP . ")"); + } + $sth_check->execute($admingroupid, $group, GROUP_BLESS); + unless ($sth_check->rows) { + $dbh->do("INSERT INTO group_group_map + (member_id, grantor_id, grant_type) + VALUES ($admingroupid, $group, " . GROUP_BLESS . ")"); + } } print "\n$login is now set up as an administrator account.\n";