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

SF.net SVN: ledger-smb: [1730] trunk



Revision: 1730
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1730&view=rev
Author:   einhverfr
Date:     2007-10-09 15:08:18 -0700 (Tue, 09 Oct 2007)

Log Message:
-----------
User::fetch_config now works, and there are some other auth fixes here too

Modified Paths:
--------------
    trunk/LedgerSMB/User.pm
    trunk/sql/Pg-database.sql

Modified: trunk/LedgerSMB/User.pm
===================================================================
--- trunk/LedgerSMB/User.pm	2007-10-09 20:29:45 UTC (rev 1729)
+++ trunk/LedgerSMB/User.pm	2007-10-09 22:08:18 UTC (rev 1730)
@@ -174,24 +174,14 @@
         &error( $self, "Access Denied" );
     }
 
+    $query = qq|
+		SELECT * FROM user_preference 
+		 WHERE id = (SELECT id FROM users WHERE username = ?)|;
+    my $sth = $dbh->prepare($query);
+    $sth->execute($lsmb->{login});
+    $myconfig = $sth->fetchrow_hashref(NAME_lc);
 
-    # for now, this is querying the table directly... ugly
-#    my $fetchUserPrefs = $dbh->prepare(
-#        "SELECT acs, address, businessnumber,
-#               company, countrycode, currency,
-#               dateformat, dbdriver, dbhost, dbname, 
-#               dboptions, dbpasswd, dbport, dbuser, 
-#               email, fax, menuwidth, name, numberformat, 
-#               password, print, printer, role, sid, 
-#               signature, stylesheet, tel, templates, 
-#               timeout, vclimit, u.username
-#          FROM users_conf as uc, users as u
-#         WHERE u.username =  ?
-#           AND u.id = uc.id;"
-#    );
-
-
-    return \%myconfig;
+    return $myconfig;
 }
 
 

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2007-10-09 20:29:45 UTC (rev 1729)
+++ trunk/sql/Pg-database.sql	2007-10-09 22:08:18 UTC (rev 1730)
@@ -980,7 +980,7 @@
 );
 --
 CREATE TABLE user_preference (
-    user_id int PRIMARY KEY REFERENCES users(id),
+    id int PRIMARY KEY REFERENCES users(id),
     language varchar(6) REFERENCES language(code),
     stylesheet text default 'ledgersmb.css' not null,
     printer text,


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