[Rt-commit] r4030 - in rt/branches/3.7-EXPERIMENTAL: . etc html/Elements

ruz at bestpractical.com ruz at bestpractical.com
Fri Nov 4 20:56:31 EST 2005


Author: ruz
Date: Fri Nov  4 20:56:28 2005
New Revision: 4030

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/etc/RT_Config.pm.in
   rt/branches/3.7-EXPERIMENTAL/html/Elements/SetupSessionCookie
Log:
 r1173 at cubic-pc:  cubic | 2005-11-05 04:57:12 +0300
  r1170 at cubic-pc:  cubic | 2005-11-05 04:56:36 +0300
  * safe session if AutoLogoff is on
  * TIMESTAMP returns local time, workaround this
 


Modified: rt/branches/3.7-EXPERIMENTAL/etc/RT_Config.pm.in
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/etc/RT_Config.pm.in	(original)
+++ rt/branches/3.7-EXPERIMENTAL/etc/RT_Config.pm.in	Fri Nov  4 20:56:28 2005
@@ -395,6 +395,13 @@
 
 # Set($WebSessionClass , 'Apache::Session::File');
 
+# By default, RT hold session unless user close browser application, with
+# $AutoLogoff option you can setup session lifetime in minutes. User
+# would be logged out if he doesn't send any requests to RT for the
+# defined time.
+
+Set($AutoLogoff, 0);
+
 # By default, RT clears its database cache after every page view.
 # This ensures that you've always got the most current information 
 # when working in a multi-process (mod_perl or FastCGI) Environment

Modified: rt/branches/3.7-EXPERIMENTAL/html/Elements/SetupSessionCookie
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Elements/SetupSessionCookie	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Elements/SetupSessionCookie	Fri Nov  4 20:56:28 2005
@@ -96,13 +96,19 @@
     } else {
         my $sth = $RT::Handle->SimpleQuery("SELECT LastUpdated FROM sessions WHERE id = ?", $session{'_session_id'});
         if( $sth ) {
-            $last_update->Set( Format => 'ISO', Value => ($sth->fetchrow_array)[0] );
+            # XXX: use datemanip format to force server's timezone because LastUpdated
+            # column is TIMESTAMP and mysql use local timezone for its values
+            # it should be changed when $date->Set would be able to handle timezones
+            $last_update->Set( Format => 'datemanip', Value => ($sth->fetchrow_array)[0] );
         }
     }
 
     if ( -$last_update->Diff( time ) > $RT::AutoLogoff * 60 ) {
         %session = ();
     }
+
+    # save session on each request when AutoLogoff is turned on
+    $session{'i'}++;
 }
 
 if ( !$cookies{$cookiename} ) {
@@ -112,7 +118,7 @@
         -path  => '/',
     );
     $r->headers_out->{'Set-Cookie'} = $cookie->as_string;
-} 
+}
 
 return();
 </%INIT>


More information about the Rt-commit mailing list