[open-ils-commits] r8428 - in
branches/acq-experiment/Open-ILS/web/oilsweb: . oilsweb/lib
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jan 18 17:33:16 EST 2008
Author: erickson
Date: 2008-01-18 17:07:24 -0500 (Fri, 18 Jan 2008)
New Revision: 8428
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/development.ini
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py
Log:
Added the ability to specify a global demo login for testing purposes,
so the manual ses=<ses> stop is not required
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/development.ini
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/development.ini 2008-01-18 22:02:32 UTC (rev 8427)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/development.ini 2008-01-18 22:07:24 UTC (rev 8428)
@@ -59,9 +59,16 @@
# path to extra templates or overridden templates
local_templates = /openils/var/web/oilsweb/oilsweb/local_templates
+# if uncommented, they system will login automatically using
+# these credentials. Note that this user will either need to
+# be an superuser or have appropriate ACQ perms
+#oils_demo_user = demo-admin
+#oils_demo_password = demo123
+#oils_demo_workstation = BR1-demo
+
# Logging configuration
[loggers]
keys = root, oilsweb
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py 2008-01-18 22:02:32 UTC (rev 8427)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py 2008-01-18 22:07:24 UTC (rev 8428)
@@ -1,5 +1,5 @@
from oilsweb.lib.context import Context, SubContext, ContextItem
-import osrf.ses, oils.utils.csedit, pylons.config
+import osrf.ses, oils.utils.csedit, pylons.config, oils.utils.utils, oils.event
from gettext import gettext as _
class AuthException(Exception):
@@ -25,6 +25,7 @@
self.user = ContextItem() # logged in user object
self.workstation = ContextItem() # workstation object
self.page = ContextItem() # the current page
+ self.use_demo = ContextItem(cgi_name='demo') # use the demo login
def postinit(self):
self.prefix = pylons.config['oils_prefix']
@@ -36,8 +37,22 @@
self.fetchUser()
+ def doLogin(self):
+ if pylons.config.get('oils_demo_user'):
+ evt = oils.utils.utils.login(
+ pylons.config['oils_demo_user'],
+ pylons.config['oils_demo_password'],
+ 'staff',
+ pylons.config['oils_demo_workstation'])
+ oils.event.Event.parse_and_raise(evt)
+ self.authtoken = evt['payload']['authtoken']
+
def fetchUser(self):
''' Grab the logged in user and their workstation '''
+
+ if not self.authtoken:
+ self.doLogin()
+
if self.authtoken:
if self.authtoken in CoreContext._auth_cache:
More information about the open-ils-commits
mailing list