diff options
author | lpsolit%gmail.com <> | 2005-10-14 10:59:53 +0200 |
---|---|---|
committer | lpsolit%gmail.com <> | 2005-10-14 10:59:53 +0200 |
commit | c872f810e18320d0b618f23b71cecc019d218cb1 (patch) | |
tree | c91fafc8042a424d3c16413c8642fb66ac95066f | |
parent | a23da324a647296a31436631b958bc3443ceaaf2 (diff) | |
download | bugzilla-c872f810e18320d0b618f23b71cecc019d218cb1.tar.gz bugzilla-c872f810e18320d0b618f23b71cecc019d218cb1.tar.xz |
Bug 312386: checksetup.pl fails to check for existing group_group_map entries for new admins - Patch by Joel Peshkin <bugreport@peshkin.net> r=karl r=LpSolit a=myk
-rwxr-xr-x | checksetup.pl | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/checksetup.pl b/checksetup.pl index f21523e5b..37067267d 100755 --- a/checksetup.pl +++ b/checksetup.pl @@ -4416,12 +4416,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"; |