1 # copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
1 # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # |
3 # |
4 # This file is part of CubicWeb. |
4 # This file is part of CubicWeb. |
5 # |
5 # |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
65 'group': 'ldap-source', 'level': 3, |
65 'group': 'ldap-source', 'level': 3, |
66 }), |
66 }), |
67 |
67 |
68 ) |
68 ) |
69 |
69 |
70 def __init__(self, repo, source_config, eid=None): |
|
71 AbstractSource.__init__(self, repo, source_config, eid) |
|
72 self.update_config(None, self.check_conf_dict(eid, source_config, |
|
73 fail_if_unknown=False)) |
|
74 |
|
75 def _entity_update(self, source_entity): |
|
76 # XXX copy from datafeed source |
|
77 if source_entity.url: |
|
78 self.urls = [url.strip() for url in source_entity.url.splitlines() |
|
79 if url.strip()] |
|
80 else: |
|
81 self.urls = [] |
|
82 # /end XXX |
|
83 ldaputils.LDAPSourceMixIn._entity_update(self, source_entity) |
|
84 |
|
85 def update_config(self, source_entity, typedconfig): |
70 def update_config(self, source_entity, typedconfig): |
86 """update configuration from source entity. `typedconfig` is config |
71 """update configuration from source entity. `typedconfig` is config |
87 properly typed with defaults set |
72 properly typed with defaults set |
88 """ |
73 """ |
89 ldaputils.LDAPSourceMixIn.update_config(self, source_entity, typedconfig) |
74 super(LDAPUserSource, self).update_config(source_entity, typedconfig) |
90 self._interval = typedconfig['synchronization-interval'] |
75 self._interval = typedconfig['synchronization-interval'] |
91 self._cache_ttl = max(71, typedconfig['cache-life-time']) |
76 self._cache_ttl = max(71, typedconfig['cache-life-time']) |
92 self.reset_caches() |
77 self.reset_caches() |
93 # XXX copy from datafeed source |
78 # XXX copy from datafeed source |
94 if source_entity is not None: |
79 if source_entity is not None: |