[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r5636 - trunk/gnue-appserver/src
From: |
reinhard |
Subject: |
r5636 - trunk/gnue-appserver/src |
Date: |
Mon, 5 Apr 2004 06:09:30 -0500 (CDT) |
Author: reinhard
Date: 2004-04-05 06:09:29 -0500 (Mon, 05 Apr 2004)
New Revision: 5636
Modified:
trunk/gnue-appserver/src/geasAuthentication.py
trunk/gnue-appserver/src/geasSessionManager.py
Log:
Fixed exceptions on login failure.
Modified: trunk/gnue-appserver/src/geasAuthentication.py
===================================================================
--- trunk/gnue-appserver/src/geasAuthentication.py 2004-04-05 10:58:11 UTC
(rev 5635)
+++ trunk/gnue-appserver/src/geasAuthentication.py 2004-04-05 11:09:29 UTC
(rev 5636)
@@ -22,9 +22,15 @@
# $Id$
import string
-from gnue.common.apps import GDebug
# =============================================================================
+# Exceptions
+# =============================================================================
+
+class AuthError (gException):
+ pass
+
+# =============================================================================
# Basic Authentication Class ( abstract )
# =============================================================================
@@ -45,7 +51,7 @@
# ---------------------------------------------------------------------------
def authenticate(self, session, user, auth):
- GDebug.printMesg (1,"Fake authentication for user %s" % user)
+ gDebug (1, "Fake authentication for user %s" % user)
return 1
@@ -55,7 +61,7 @@
# ---------------------------------------------------------------------------
def hasAccess (self, session, user, classname):
- GDebug.printMesg (1, "Fake access check for class %s and user %s" % \
+ gDebug (1, "Fake access check for class %s and user %s" % \
(classname,user))
return 1
@@ -84,32 +90,28 @@
def authenticate (self, session, user, auth):
authList = self._intSess.request ("gnue_useraccess",
- [['eq', ''],['field',
'gnue_username'],['const', user ]],
- [],["gnue_username", "gnue_password",
"gnue_accesslist"])
+ [['eq', ''],
+ ['field', 'gnue_username'],
+ ['const', user ]],
+ [],
+ ["gnue_username", "gnue_password",
+ "gnue_accesslist"])
- authData = self._intSess.fetch (authList,0,10)
+ authData = self._intSess.fetch (authList, 0, 10)
if len (authData) == 0:
- # log something
- GDebug.printMesg (1, _("User '%s' does not exist.") % user)
- return 0 # = no access
+ raise AuthError, u_("User '%s' does not exist.") % user
if len (authData) > 1:
- # log something
- GDebug.printMesg (1, _(
-"""Internal Error: More than one (%(numrec)s) record
-for user '%(username)s'.""") % {"numrec" : len (authData),
- "username": user})
+ raise AuthError, u_("Internal Error: More than one (%(numrec)s) record "
+ "for user '%(username)s'." \
+ % {"numrec" : len (authData), "username": user})
- if authData[0][2] != auth['password']:
- # log something
- GDebug.printMesg (1, _("""User '%s' didn't provide correct
-authentication information (password).""") % user)
+ if authData [0] [2] != auth ['password']:
+ raise AuthError, u_("Invalid password for user '%s'") % user
- return 0 # = no access
+ gDebug (1, "User '%s' logged in." % user)
- GDebug.printMesg (1, _("User '%s' logged in.") % user)
-
# possibly not the best solution
session.tablelist = string.split (authData[0][3],',')
@@ -126,9 +128,8 @@
if hasattr (session, "tablelist") and ('all' in tables or classname in
tables):
return 1
else:
- GDebug.printMesg (1, _("""User '%(username)s' has no access to
-class %(classname)s.""") % {"username" : user,
- "classname": classname})
+ gDebug (1, "User '%(username)s' has no access to class %(classname)s." \
+ % {"username" : user, "classname": classname})
return 0
# =============================================================================
Modified: trunk/gnue-appserver/src/geasSessionManager.py
===================================================================
--- trunk/gnue-appserver/src/geasSessionManager.py 2004-04-05 10:58:11 UTC
(rev 5635)
+++ trunk/gnue-appserver/src/geasSessionManager.py 2004-04-05 11:09:29 UTC
(rev 5636)
@@ -30,13 +30,6 @@
from gnue.common.datasources import GConnections
# =============================================================================
-# Exceptions
-# =============================================================================
-
-class AuthError (gException):
- pass
-
-# =============================================================================
# Session Manager class
# =============================================================================
@@ -99,9 +92,7 @@
sess = geasSession.geasSession (conn, self._authAdapter, self,
self._sessNo)
- if not sess.login (authentication ['user'],
- authentication ['password']):
- raise AuthError
+ sess.login (authentication ['user'], authentication ['password'])
self._sessions [self._sessNo] = sess
return self._sessNo
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r5636 - trunk/gnue-appserver/src,
reinhard <=