server/sources/ldapuser.py
branchstable
changeset 5456 d040889fac4e
parent 5426 0d4853a6e5ee
parent 5455 3dc47a52dd19
child 5603 d8d9f4ec252d
--- a/server/sources/ldapuser.py	Fri Apr 30 19:58:17 2010 +0200
+++ b/server/sources/ldapuser.py	Tue May 04 14:16:04 2010 +0200
@@ -44,6 +44,7 @@
 from ldap.filter import filter_format, escape_filter_chars
 from ldapurl import LDAPUrl
 
+from logilab.common.configuration import time_validator
 from cubicweb import AuthenticationError, UnknownEid, RepositoryError
 from cubicweb.server.utils import cartesian_product
 from cubicweb.server.sources import (AbstractSource, TrFunc, GlobTrFunc,
@@ -85,13 +86,13 @@
           'default': 'simple',
           'choices': ('simple', 'cram_md5', 'digest_md5', 'gssapi'),
           'help': 'authentication mode used to authenticate user to the ldap.',
-          'group': 'ldap-source', 'level': 1,
+          'group': 'ldap-source', 'level': 3,
           }),
         ('auth-realm',
          {'type' : 'string',
           'default': None,
           'help': 'realm to use when using gssapi/kerberos authentication.',
-          'group': 'ldap-source', 'level': 1,
+          'group': 'ldap-source', 'level': 3,
           }),
 
         ('data-cnx-dn',
@@ -152,13 +153,13 @@
           'default': '1d',
           'help': 'interval between synchronization with the ldap \
 directory (default to once a day).',
-          'group': 'ldap-source', 'level': 2,
+          'group': 'ldap-source', 'level': 3,
           }),
         ('cache-life-time',
          {'type' : 'time',
           'default': '2h',
           'help': 'life time of query cache in minutes (default to two hours).',
-          'group': 'ldap-source', 'level': 2,
+          'group': 'ldap-source', 'level': 3,
           }),
 
     )
@@ -186,9 +187,11 @@
                               for o in self.user_classes]
         self._conn = None
         self._cache = {}
-        ttlm = int(source_config.get('cache-life-type', 2*60))
+        ttlm = time_validator(None, None,
+                              source_config.get('cache-life-time', 2*60))
         self._query_cache = TimedCache(ttlm)
-        self._interval = int(source_config.get('synchronization-interval',
+        self._interval = time_validator(None, None,
+                                        source_config.get('synchronization-interval',
                                                24*60*60))
 
     def reset_caches(self):