[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3161] trunk/LedgerSMB/Initiate.pm



Revision: 3161
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3161&view=rev
Author:   einhverfr
Date:     2011-05-22 22:15:35 +0000 (Sun, 22 May 2011)

Log Message:
-----------
Ian's patch 2945467

Modified Paths:
--------------
    trunk/LedgerSMB/Initiate.pm

Modified: trunk/LedgerSMB/Initiate.pm
===================================================================
--- trunk/LedgerSMB/Initiate.pm	2011-05-22 22:02:08 UTC (rev 3160)
+++ trunk/LedgerSMB/Initiate.pm	2011-05-22 22:15:35 UTC (rev 3161)
@@ -336,16 +336,7 @@
 	#create admin user 
 
     my $dbh = $form->{dbh}; # used only for quote and quote_identifier
-	if ($form->{createuser}){
 
-		print PSQL qq| create user | . 
-			$dbh->quote_identifier($form->{admin_username}) .
-            qq| WITH CREATEROLE | .
-			qq| WITH PASSWORD | .
-			$dbh->quote($form->{admin_password}) .
-            ";\n";
-    }
-
     print PSQL "GRANT " .
         $dbh->quote_identifier("lsmb_${company}__users_manage")  . 
         " TO " .
@@ -422,16 +413,19 @@
 		$form->{dbh}->do(
             "CREATE ROLE " . 
 			$form->{dbh}->quote_identifier($form->{admin_username}) .
-            " WITH CREATEROLE " .
-			" WITH PASSWORD " .  $dbh->quote($form->{admin_password}) .
+            " CREATEROLE LOGIN" .
+			" PASSWORD " .  $form->{dbh}->quote($form->{admin_password}) .
             ";\n"
-        );
+        ) || $logger->error(__FILE__ . ':' . __LINE__ . ': ',
+            "create role $form->{admin_username} failed");
     }
 
     $form->{dbh}->do(
-        "create database $form->{database} with owner $form->{username}"
+        "create database $form->{database} " .
+        "  with owner $form->{admin_username}"
     ) || $form->error( __FILE__ . ':' . __LINE__ . ': '
             . $locale->text( 'database [_1] creation failed',$database));
+
 }
 
 sub handle_create_language


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.