From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 8 Feb 2008 21:57:00 -0000 Subject: [Cluster-devel] conga ./conga.spec.in.in luci/cluster/cluster_ ... Message-ID: <20080208215700.29466.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: conga Branch: RHEL5 Changes by: rmccabe at sourceware.org 2008-02-08 21:56:56 Modified files: . : conga.spec.in.in luci/cluster : cluster_config-macros cluster_svc-macros form-chooser form-macros index_html system_svc-macros luci/homebase : form-macros index_html luci/site/luci/Extensions: LuciZope.py LuciZopeAsync.py LuciZopeExternal.py conga_constants.py luci/site/luci/var: Data.fs luci/storage : index_html Added files: luci/plone-custom: manage_inactive.js Log message: - Fix bz429151 ([RFE] Luci: increase min password length to 6 characters) - Fix bz429152 ([RFE] add inactivity timeout) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.45.2.67&r2=1.45.2.68 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/cluster_config-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.1&r2=1.3.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/cluster_svc-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.1&r2=1.3.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-chooser.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.12.2.7&r2=1.12.2.8 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.90.2.33&r2=1.90.2.34 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/index_html.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.20.2.14&r2=1.20.2.15 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/system_svc-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2.2.1&r2=1.2.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.44.2.13&r2=1.44.2.14 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/index_html.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.18.2.6&r2=1.18.2.7 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/manage_inactive.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZope.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.4.5&r2=1.1.4.6 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopeAsync.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.4&r2=1.1.2.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopeExternal.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.4.3&r2=1.1.4.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.19.2.15&r2=1.19.2.16 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/var/Data.fs.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.15.2.28&r2=1.15.2.29 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/storage/index_html.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.7.2.5&r2=1.7.2.6 --- conga/conga.spec.in.in 2008/02/07 06:52:55 1.45.2.67 +++ conga/conga.spec.in.in 2008/02/08 21:56:33 1.45.2.68 @@ -292,6 +292,10 @@ ### changelog ### %changelog +* Fri Feb 08 2008 Ryan McCabe 0.12.0-4 +- Fix bz429151 ([RFE] Luci: increase min password length to 6 characters) +- Fix bz429152 ([RFE] add inactivity timeout) + * Wed Feb 06 2008 Ryan McCabe 0.12.0-3 - Fix bz431105 (IP Address Resource configuration: cannot enter fully qualified hostname) --- conga/luci/cluster/cluster_config-macros 2008/01/23 04:44:30 1.3.2.1 +++ conga/luci/cluster/cluster_config-macros 2008/02/08 21:56:33 1.3.2.2 @@ -22,9 +22,6 @@ var cur_label_elem = null; - --- conga/luci/cluster/cluster_svc-macros 2008/01/23 04:44:30 1.3.2.1 +++ conga/luci/cluster/cluster_svc-macros 2008/02/08 21:56:33 1.3.2.2 @@ -623,7 +623,6 @@ - --- conga/luci/cluster/form-chooser 2008/01/23 04:44:30 1.12.2.7 +++ conga/luci/cluster/form-chooser 2008/02/08 21:56:33 1.12.2.8 @@ -229,6 +229,14 @@
+ + +
+ + + +
+ --- conga/luci/cluster/form-macros 2008/01/25 17:18:37 1.90.2.33 +++ conga/luci/cluster/form-macros 2008/02/08 21:56:33 1.90.2.34 @@ -156,7 +156,6 @@ - -
+
+ +
+ +
+ +
+ + --- conga/luci/cluster/index_html 2008/01/23 04:44:30 1.20.2.14 +++ conga/luci/cluster/index_html 2008/02/08 21:56:33 1.20.2.15 @@ -58,17 +58,10 @@ - - - /cvs/cluster/conga/luci/plone-custom/manage_inactive.js,v --> standard output revision 1.1.2.1 --- conga/luci/plone-custom/manage_inactive.js +++ - 2008-02-08 21:56:58.251531000 +0000 @@ -0,0 +1,84 @@ +/* +** Copyright (C) 2008 Red Hat, Inc. +** +** This program is free software; you can redistribute +** it and/or modify it under the terms of version 2 of the +** GNU General Public License as published by the +** Free Software Foundation. +*/ + +var update_activity_url = '/luci/cluster?pagetype=1011'; +var check_inactive_url = '/luci/cluster?pagetype=1010'; +var pending_events = 0; + +function activity_event_handler() { + ++pending_events; +} + +function update_activity_check(ret_status, obj) { + /* Doesn't matter what comes back */ + return; +} + +function check_inactive_check(ret_status, obj) { + if (ret_status === null) { + return; + } + + if (ret_status !== true) { + /* A communication error occurred. */ + return; + } + + var err = get_ricci_response_status(obj.responseXML); + if (err !== null && err.length > 0) { + alert(err.join('\n')); + return; + } + + try { + obj = obj.responseXML.getElementsByTagName('dict')[0]; + } catch (e) { + alert('Received a malformed response from the luci server.'); + return; + } + + var var_elem = obj.getElementsByTagName('var'); + for (var i = 0 ; i < var_elem.length ; i++) { + if (var_elem[i].getAttribute('name') == 'inactive') { + if (var_elem[i].getAttribute('value') != 'False') { + window.location.assign('/luci/logout'); + alert('You have been logged out due to inactivity.'); + } + } + } +} + +function update_activity_callback() { + return check_ajax_xml(xmlHttp_object, update_activity_check); +} + +function check_inactive_callback() { + return check_ajax_xml(xmlHttp_object, check_inactive_check); +} + +function update_last_active() { + if (pending_events < 1) { + return (false); + } + initiate_async_get(update_activity_url, update_activity_callback); + pending_events = 0; + return (true); +} + +function check_user_inactive() { + if (update_last_active() === true) { + return (0); + } + return (initiate_async_get(check_inactive_url, check_inactive_callback)); +} + +setInterval("update_last_active()", 1000 * 30); +setInterval("check_user_inactive()", 1000 * 60); +window.onmousemove = new Function('activity_event_handler()'); +window.onkeypress = new Function('activity_event_handler()'); --- conga/luci/site/luci/Extensions/LuciZope.py 2008/01/23 04:44:32 1.1.4.5 +++ conga/luci/site/luci/Extensions/LuciZope.py 2008/02/08 21:56:33 1.1.4.6 @@ -82,6 +82,8 @@ if not userAuthenticated(self): return [] + enforce_inactivity_timeout(self, req) + htab = { 'Title': 'homebase', 'Description': 'Home base for this luci server', @@ -163,4 +165,42 @@ return '/luci/cluster/index_html?pagetype=7&clustername=%s' % clustername +def user_update_inactive(self, request): + from time import time + if userAuthenticated(self): + request.SESSION.set('last_activity', int(time())) + +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 (False, -1) + 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 (False, -2) + old_time = int(old_time) + + time_diff = cur_time - old_time + if time_diff >= INACTIVITY_TIMEOUT: + return (True, time_diff) + return (False, time_diff) + +def enforce_inactivity_timeout(self, request): + from time import time + pagetype = request.get('pagetype') + if pagetype != '1010' and pagetype != '1011': + (ret, dummy) = user_check_inactive(self, request) + if ret is True: + 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', int(time())) --- conga/luci/site/luci/Extensions/LuciZopeAsync.py 2008/02/07 06:52:56 1.1.2.4 +++ conga/luci/site/luci/Extensions/LuciZopeAsync.py 2008/02/08 21:56:33 1.1.2.5 @@ -169,6 +169,18 @@ xml_obj = result_to_xml((len(errors) < len(node_list), ret)) write_xml_resp(request, xml_obj) +def check_inactive_async(self, request): + from LuciZope import user_check_inactive + (inactive, diff) = user_check_inactive(self, request) + xml_obj = result_to_xml((True, { 'inactive': inactive, 'diff': diff })) + write_xml_resp(request, xml_obj) + +def update_inactive_async(self, request): + from LuciZope import user_update_inactive + user_update_inactive(self, request) + xml_obj = result_to_xml((True, { 'result': True })) + write_xml_resp(request, xml_obj) + def get_sysinfo_async(self, request): from HelperFunctions import get_system_info --- conga/luci/site/luci/Extensions/LuciZopeExternal.py 2008/01/23 04:44:32 1.1.4.3 +++ conga/luci/site/luci/Extensions/LuciZopeExternal.py 2008/02/08 21:56:33 1.1.4.4 @@ -55,4 +55,4 @@ from system_adapters import get_sys_svc_list, validate_manage_svc from LuciZopeAsync import get_cluster_nodes_async, get_sysinfo_async, \ - validate_clusvc_async + validate_clusvc_async, check_inactive_async, update_inactive_async --- conga/luci/site/luci/Extensions/conga_constants.py 2008/01/23 04:44:32 1.19.2.15 +++ conga/luci/site/luci/Extensions/conga_constants.py 2008/02/08 21:56:33 1.19.2.16 @@ -147,6 +147,9 @@ REDIRECT_MSG = ' -- You will be redirected in %d seconds.' % REDIRECT_SEC +# Log users out after 10 minutes of inactivity. + +INACTIVITY_TIMEOUT_SEC = 600 # Debugging parameters. Set LUCI_DEBUG_MODE to True and LUCI_DEBUG_VERBOSITY # to >= 2 to get full debugging output in syslog (LOG_DAEMON/LOG_DEBUG). Binary files /cvs/cluster/conga/luci/site/luci/var/Data.fs 2008/02/07 06:52:56 1.15.2.28 and /cvs/cluster/conga/luci/site/luci/var/Data.fs 2008/02/08 21:56:33 1.15.2.29 differ rcsdiff: /cvs/cluster/conga/luci/site/luci/var/Data.fs: diff failed --- conga/luci/storage/index_html 2008/01/23 04:44:56 1.7.2.5 +++ conga/luci/storage/index_html 2008/02/08 21:56:56 1.7.2.6 @@ -36,7 +36,6 @@ -