[Rt-commit] r7364 - rt/branches/3.7-EXPERIMENTAL-TUNIS/etc

clkao at bestpractical.com clkao at bestpractical.com
Tue Mar 27 07:53:26 EDT 2007


Author: clkao
Date: Tue Mar 27 07:53:25 2007
New Revision: 7364

Modified:
   rt/branches/3.7-EXPERIMENTAL-TUNIS/etc/acl.Pg

Log:
Reuse existing rt_user for Pg.

Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/etc/acl.Pg
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/etc/acl.Pg	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/etc/acl.Pg	Tue Mar 27 07:53:25 2007
@@ -51,13 +51,12 @@
     my $db_user = RT->Config->Get('DatabaseUser');
     my $db_pass = RT->Config->Get('DatabasePassword');
 
-    # if there's already an rt_user, drop it.
+    # if there's already an rt_user, use it.
     my @row = $dbh->selectrow_array( "SELECT usename FROM pg_user WHERE usename = '$db_user'" );
-    if ( $row[0] ) {
-        push @acls, "DROP USER $db_user;";
+    unless ( $row[0] ) {
+	 push @acls, "CREATE USER $db_user WITH PASSWORD '$db_pass' NOCREATEDB NOCREATEUSER;";
     }
 
-    push @acls, "CREATE USER $db_user WITH PASSWORD '$db_pass' NOCREATEDB NOCREATEUSER;";
     foreach my $table (@tables) {
         push @acls, "GRANT SELECT, INSERT, UPDATE, DELETE ON $table TO $db_user;"
     }


More information about the Rt-commit mailing list