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 | |
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
-rwxr-xr-x | LedgerSMB/User.pm | 23 | ||||
-rwxr-xr-x | bin/mozilla/admin.pl | 11 | ||||
-rw-r--r-- | ledger-smb.conf | 44 |
3 files changed, 26 insertions, 52 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}; diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl index 9ebc29de..5da3a86e 100755 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -1165,13 +1165,18 @@ sub dbselect_source { <tr> <th align="right">|.$locale->text('User').qq|</th> <td><input name="dbuser" size="10" value="$form->{dbuser}" /></td> - <th align="right">|.$locale->text('Password').qq|</th> - <td><input type="password" name="dbpasswd" size="10" /></td> +<th align="right">|.$locale->text('Password').qq|</th> +<td><input type="password" name="dbpasswd" size="10" /></td> </tr> <tr> <th align="right">$form->{connectstring}</th> <td colspan="3"><input name="dbdefault" size="10" value="$form->{dbdefault}" /></td> </tr> +<th align="right">|.$locale->text("Superuser").qq|</th> + <td><input name="dbsuperuser" size="10" value="$form->{dbsuperuser}" /></td> +<th align="right">|.$locale->text('Password').qq|</th> +<td><input type="password" name="dbsuperpasswd" size="10" /></td> + </table> </td> </tr> @@ -1317,7 +1322,7 @@ sub create_dataset { </table> |; - $form->hide_form(qw(dbdriver dbuser dbhost dbport dbpasswd dbdefault path sessionid)); + $form->hide_form(qw(dbdriver dbsuperuser dbsuperpasswd dbuser dbhost dbport dbpasswd dbdefault path sessionid)); print qq| <input name="callback" type="hidden" value="$form->{script}?action=list_users&path=$form->{path}&sessionid=$form->{sessionid}" /> diff --git a/ledger-smb.conf b/ledger-smb.conf deleted file mode 100644 index 0589278c..00000000 --- a/ledger-smb.conf +++ /dev/null @@ -1,44 +0,0 @@ -use vars qw($userspath $spool $memberfile $templates $sendmail $language $sid $latex %printer $gzip); - -# path to user configuration files -$userspath = "users"; - -# spool directory for batch printing -$spool = "spool"; - -# templates base directory -$templates = "templates"; - -# member file -$memberfile = "users/members"; - -# location of sendmail -$sendmail = "| /usr/sbin/sendmail -t"; - -# set language for login and admin -$language = ""; - -# Maximum number of invoices that can be printed on a check -$check_max_invoices = 5; - - -# if you have latex installed set to 1 -$latex = 1; - -# available printers -%printer = ( Laser => 'lpr -Plaser', - Epson => 'lpr -PEpson', - ); - -# program to use for file compression -$gzip = "gzip -S .gz"; - -# if the server can't find gzip, latex, dvips or pdflatex, add the path -$ENV{PATH} .= ":/usr/local/bin:/usr/local/pgsql/bin"; - -# on mac os X using Fink's Perl libs, add the path -#$ENV{PERL5LIB} .= ":/sw/lib/perl5"; - - -1; - |