commit-gnue
[Top][All Lists]
Advanced

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

r6285 - in trunk: gnue-appserver/src gnue-common/src/datasources/drivers


From: johannes
Subject: r6285 - in trunk: gnue-appserver/src gnue-common/src/datasources/drivers/appserver/appserver gnue-common/src/datasources/drivers/postgresql/Base
Date: Wed, 15 Sep 2004 04:05:59 -0500 (CDT)

Author: johannes
Date: 2004-09-15 04:05:58 -0500 (Wed, 15 Sep 2004)
New Revision: 6285

Modified:
   trunk/gnue-appserver/src/geasAuthentication.py
   trunk/gnue-appserver/src/geasSessionManager.py
   trunk/gnue-common/src/datasources/drivers/appserver/appserver/Connection.py
   trunk/gnue-common/src/datasources/drivers/postgresql/Base/Connection.py
Log:
Added a gnue.conf setting 'authentication' which defaults to False. This means 
appserver no longer requires 'gnue_useraccess' but still supports it


Modified: trunk/gnue-appserver/src/geasAuthentication.py
===================================================================
--- trunk/gnue-appserver/src/geasAuthentication.py      2004-09-14 19:02:24 UTC 
(rev 6284)
+++ trunk/gnue-appserver/src/geasAuthentication.py      2004-09-15 09:05:58 UTC 
(rev 6285)
@@ -51,9 +51,8 @@
   # return 1 on access ok  (0=access denied)
   # ---------------------------------------------------------------------------
 
-  def authenticate(self, session, user, auth):
-    gDebug (1, "Fake authentication for user %s" % user)
-    return 1
+  def authenticate (self, session, user, auth):
+    return True
 
 
   # ---------------------------------------------------------------------------
@@ -62,9 +61,7 @@
   # ---------------------------------------------------------------------------
 
   def hasAccess (self, session, user, classname):
-    gDebug (1, "Fake access check for class %s and user %s" % \
-                         (classname,user))
-    return 1
+    return True
 
 # =============================================================================
 # Database Authentication Agent
@@ -124,12 +121,12 @@
     # this should be changed to check for the user again.
     # it will only be secure if the protocol supports session-management too.
     tables = session.tablelist
-    if hasattr (session, "tablelist") and ('all' in tables or classname in 
tables):
-      return 1
+    if 'all' in tables or classname in tables:
+      return True
     else:
       gDebug (1, "User '%(username)s' has no access to class %(classname)s." \
                  % {"username" : user, "classname": classname})
-      return 0
+      return False
 
 # =============================================================================
 # PAM Authentication Agent

Modified: trunk/gnue-appserver/src/geasSessionManager.py
===================================================================
--- trunk/gnue-appserver/src/geasSessionManager.py      2004-09-14 19:02:24 UTC 
(rev 6284)
+++ trunk/gnue-appserver/src/geasSessionManager.py      2004-09-15 09:05:58 UTC 
(rev 6285)
@@ -29,7 +29,7 @@
 
 from gnue import appserver
 from gnue.common.datasources import GConnections
-from gnue.common.apps import i18n
+from gnue.common.apps import i18n, GConfig
 
 # =============================================================================
 # Exceptions
@@ -57,8 +57,16 @@
     self._buildInternalSession ()
     classrep.init (self)
 
-    # TODO: load default authagent depending on config setting
-    self._authAdapter = geasAuthentication.geasDBAuthAgent 
(self._internalSession)
+    cfg = gConfigDict (section = 'appserver')
+    dbauth = cfg.get ('authentication', 'False')
+    if dbauth.lower () in ['true', 'yes', 'y']:
+      gDebug (1, "Using DB Auth Agent")
+      self._authAdapter = geasAuthentication.geasDBAuthAgent ( \
+                                                         self._internalSession)
+    else:
+      gDebug (1, "Using dummy Auth Agent")
+      self._authAdapter = geasAuthentication.geasAuthAgent ()
+
     self._langRuntimes = {}
 
   # ---------------------------------------------------------------------------

Modified: 
trunk/gnue-common/src/datasources/drivers/appserver/appserver/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/appserver/appserver/Connection.py 
2004-09-14 19:02:24 UTC (rev 6284)
+++ trunk/gnue-common/src/datasources/drivers/appserver/appserver/Connection.py 
2004-09-15 09:05:58 UTC (rev 6285)
@@ -31,7 +31,7 @@
 from gnue.common.datasources import Exceptions
 from gnue.common.datasources.drivers import Base
 from gnue.common.rpc import client
-from gnue.common.apps import errors
+from gnue.common.apps import errors, GConfig
 
 import DataObject
 
@@ -55,7 +55,12 @@
   # ---------------------------------------------------------------------------
 
   def getLoginFields (self):
-    return [['_username', _('User Name'), 0], ['_password', _('Password'), 1]]
+    cfg = gConfigDict (section = 'appserver')
+    dbauth = cfg.get ('authentication', 'False')
+    if dbauth.lower () in ['true', 'yes', 'y']:
+      return [['_username', _('User Name'), 0], ['_password', _('Password'), 
1]]
+    else:
+      return []
 
   # ---------------------------------------------------------------------------
   # Open a connection
@@ -63,11 +68,11 @@
 
   def connect (self, connectData):
 
-    user = connectData ['_username']
-    passwd = connectData ['_password']
+    user   = connectData.get ('_username', None)
+    passwd = connectData.get ('_password', None)
 
-    params = {'host': connectData ['host'],
-              'port': connectData ['port'],
+    params = {'host'     : connectData ['host'],
+              'port'     : connectData ['port'],
               'transport': connectData ['transport']}
 
     self._server = client.attach (connectData ['rpctype'], params)

Modified: 
trunk/gnue-common/src/datasources/drivers/postgresql/Base/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/postgresql/Base/Connection.py     
2004-09-14 19:02:24 UTC (rev 6284)
+++ trunk/gnue-common/src/datasources/drivers/postgresql/Base/Connection.py     
2004-09-15 09:05:58 UTC (rev 6285)
@@ -23,13 +23,11 @@
 
 __all__ = ['Connection']
 
-import string
-from string import lower, join, split
-import sys
-from gnue.common.apps import GDebug, GConfig, errors
+from gnue.common.apps import errors
 from gnue.common.datasources import Exceptions
 from gnue.common.datasources.drivers import DBSIG2
 from DataObject import *
+
 from gnue.common.datasources.drivers.postgresql.Schema.Discovery.Introspection 
import Introspection
 from gnue.common.datasources.drivers.postgresql.Schema.Creation.Creation 
import Creation
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]