diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-09-19 05:42:37 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-09-19 05:42:37 +0000 |
commit | 1d5954c206a9ee3df74bee6197770794854313fc (patch) | |
tree | 11461a4cfee0dc5d552563f6c868f14cee732c59 /LedgerSMB | |
parent | 22ef8cb0ad0ac9758c3d9dde8b798350a4ba7583 (diff) |
Added superuser login for admin.pl and User.pm
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@117 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rwxr-xr-x | LedgerSMB/User.pm | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/LedgerSMB/User.pm b/LedgerSMB/User.pm index e0f2bc6b..b4cfca78 100755 --- a/LedgerSMB/User.pm +++ b/LedgerSMB/User.pm @@ -308,23 +308,36 @@ sub dbcreate { &dbconnect_vars($form, $form->{dbdefault}); # The below line connects to Template1 or another template file in order # to create the db. One must disconnect and reconnect later. - my $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror; + my $superdbh = DBI->connect( + $form->{dbconnect}, + $form->{dbsuperuser}, + $form->{dbsuperpasswd} + ) or $form->dberror; my $query = qq|$dbcreate{$form->{dbdriver}}|; - $dbh->do($query) || $form->dberror($query); + $superdbh->do($query) || $form->dberror($query); - $dbh->disconnect; + $superdbh->disconnect; #Reassign for the work below &dbconnect_vars($form, $form->{db}); - my $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror; + my $dbh = DBI->connect( + $form->{dbconnect}, + $form->{dbuser}, + $form->{dbpasswd} + ) or $form->dberror; + my $superdbh = DBI->connect( + $form->{dbconnect}, + $form->{dbsuperuser}, + $form->{dbsuperpasswd} + ) or $form->dberror; # JD: We need to check for plpgsql, if it isn't there create it, if we can't error # Good chance I will have to do this twice as I get used to the way the code is # structured my %langcreate = ( 'Pg' => qq|CREATE LANGUAGE plpgsql|); my $query = qq|$langcreate{$form->{dbdriver}}|; - $dbh->do($query) || $form->dberror($query); + $superdbh->do($query); # create the tables my $dbdriver = ($form->{dbdriver} =~ /Pg/) ? 'Pg' : $form->{dbdriver}; |