浏览代码

HUE-1528 [core] expose way to change session timeout

Abraham Elmahrek 12 年之前
父节点
当前提交
4ed5122

+ 7 - 0
desktop/conf.dist/hue.ini

@@ -174,6 +174,13 @@
     ## password=
     ## name=desktop/desktop.db
 
+  # Configuration options for specifying the Desktop session.
+  # For more info, see https://docs.djangoproject.com/en/1.4/topics/http/sessions/
+  # ------------------------------------------------------------------------
+  [[session]]
+    # The cookie containing the users' session ID will expire after this amount of time in seconds.
+    ## ttl=60*60*24*14
+
 
   # Configuration options for connecting to an external SMTP server
   # ------------------------------------------------------------------------

+ 6 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -180,6 +180,12 @@
     ## password=
     ## name=desktop/desktop.db
 
+  # Configuration options for specifying the Desktop session.
+  # For more info, see https://docs.djangoproject.com/en/1.4/topics/http/sessions/
+  # ------------------------------------------------------------------------
+  [[session]]
+    # The cookie containing the users' session ID will expire after this amount of time in seconds.
+    ## ttl=60*60*24*14
 
   # Configuration options for connecting to an external SMTP server
   # ------------------------------------------------------------------------

+ 14 - 0
desktop/core/src/desktop/conf.py

@@ -211,6 +211,20 @@ DATABASE = ConfigSection(
   )
 )
 
+SESSION = ConfigSection(
+  key='session',
+  help=_("""Configuration options for specifying the Desktop session.
+          For more info, see https://docs.djangoproject.com/en/1.4/topics/http/sessions/"""),
+  members=dict(
+    TTL=Config(
+      key='ttl',
+      help=_("The cookie containing the users' session ID will expire after this amount of time in seconds."),
+      type=int,
+      default=60*60*24*14,
+    )
+  )
+)
+
 KERBEROS = ConfigSection(
   key="kerberos",
   help=_("""Configuration options for specifying Hue's Kerberos integration for

+ 3 - 0
desktop/core/src/desktop/settings.py

@@ -249,6 +249,9 @@ DATABASES = {
   'default': default_db
 }
 
+# Configure sessions
+SESSION_COOKIE_AGE = desktop.conf.SESSION.TTL.get()
+
 # django-nose test specifics
 TEST_RUNNER = 'desktop.lib.test_runners.HueTestRunner'
 # Turn off cache middleware