From 2a7cffad68540d58c8407725219715c3097864bb Mon Sep 17 00:00:00 2001 From: einhverfr Date: Thu, 2 Oct 2008 15:25:35 +0000 Subject: Committing Sadashiva's fix for Access Denied when deleting user git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@2347 4979c152-3d1c-0410-bac9-87ea11338e46 --- CONTRIBUTORS | 3 +++ bin/admin.pl | 20 ++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index d50c4017..6a5d6df7 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -69,6 +69,9 @@ Donna Robinson [email omitted] contributed some fixes to the HTML code. Victor Sterpu has contributed several bug fixes to COGS handling. +Sadashiva [email omitted] has committed a fix to the admin screen regarding access +errors when deleting a user. + Original Authors of SQL-Ledger: =================================== Dieter Simader diff --git a/bin/admin.pl b/bin/admin.pl index 42022d36..1019b204 100755 --- a/bin/admin.pl +++ b/bin/admin.pl @@ -938,16 +938,20 @@ sub delete { } #users_conf - my $deleteUser = - $dbh->prepare( -"DELETE FROM users_conf USING users WHERE users.username = ? and users.id = users_conf.id;" - ); - $deleteUser->execute( $form->{login} ); + + my $deleteUser = $dbh->prepare("select id FROM users WHERE username = ?;"); - #and now users - $deleteUser = $dbh->prepare("DELETE FROM users WHERE username = ?;"); $deleteUser->execute( $form->{login} ); + my $id1=$deleteUser->fetchrow(); + + $dbh->do("DELETE FROM users_conf WHERE id=$id1;") or print "error"; + $dbh->do("DELETE FROM users WHERE id=$id1;") or print "Error"; + + $form->{login}="admin"; + + + $form->redirect( $locale->text('User deleted!') ); } @@ -971,7 +975,7 @@ sub change_admin_password { print qq| -
+ -- cgit v1.2.3
| . $locale->text('Change Password') . qq|