cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/site/luci/Extensions LuciZope.py Lu ...
Date: 6 Feb 2008 05:19:58 -0000	[thread overview]
Message-ID: <20080206051958.7254.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2008-02-06 05:19:57

Modified files:
	luci/site/luci/Extensions: LuciZope.py LuciZopeExternal.py 
	                           conga_constants.py 

Log message:
	backend support for automatic logout due to user inactivity

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZope.py.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopeExternal.py.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&r1=1.47&r2=1.48

--- conga/luci/site/luci/Extensions/LuciZope.py	2008/01/02 21:00:31	1.7
+++ conga/luci/site/luci/Extensions/LuciZope.py	2008/02/06 05:19:57	1.8
@@ -163,4 +163,28 @@
 
 	return '/luci/cluster/index_html?pagetype=7&clustername=%s' % clustername
 
+def user_check_inactive(self, request):
+	from time import time
+	from conga_constants import INACTIVITY_TIMEOUT_SEC as INACTIVITY_TIMEOUT
 
+	if not userAuthenticated(self):
+		return
+
+	cur_time = int(time())
+	old_time = request.SESSION.get('last_activity', None)
+	if old_time is None:
+		request.SESSION.set('last_activity', cur_time)
+		return
+	old_time = int(old_time)
+
+	time_diff = cur_time - old_time
+	if time_diff >= INACTIVITY_TIMEOUT:
+		try:
+			request.SESSION.getBrowserIdManager().flushBrowserIdCookie()
+			request.SESSION.invalidate()
+		except Exception, e:
+			if LUCI_DEBUG_MODE is True:
+				luci_log.debug_verbose('UCI0: %r %s' % (e, str(e)))
+		request.RESPONSE.redirect('/luci/logout')
+	else:
+		request.SESSION.set('last_activity', cur_time)
--- conga/luci/site/luci/Extensions/LuciZopeExternal.py	2008/01/22 15:05:17	1.7
+++ conga/luci/site/luci/Extensions/LuciZopeExternal.py	2008/02/06 05:19:57	1.8
@@ -35,7 +35,7 @@
 
 from LuciZope import appendModel, bytes_to_value_prefunits, \
 	set_persistent_var, strFilter, getTabs, siteIsSetup, \
-	getClusterURL
+	getClusterURL, user_check_inactive
 
 from LuciZopeClusterPortal import createCluChooser, createCluConfigTree
 
--- conga/luci/site/luci/Extensions/conga_constants.py	2008/01/02 21:00:32	1.47
+++ conga/luci/site/luci/Extensions/conga_constants.py	2008/02/06 05:19:57	1.48
@@ -136,6 +136,7 @@
 ]
 
 REDIRECT_SEC = 5
+INACTIVITY_TIMEOUT_SEC = 600
 
 # cluster/node create error status messages
 PRE_INSTALL = 'The install state is not yet complete.'



                 reply	other threads:[~2008-02-06  5:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080206051958.7254.qmail@sourceware.org \
    --to=rmccabe@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).