LdapClient: init cache in __init__ method and reset it during initialization
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Fix cache sharing problem when multiple clients are used on same soft
This commit is contained in:
Benjamin Renard 2022-05-27 14:11:40 +02:00
parent e7e07a944a
commit ade97bc90f

View file

@ -346,13 +346,14 @@ class LdapClient:
_conn = None
# Cache objects
_cached_objects = dict()
_cached_objects = None
def __init__(self, options=None, options_prefix=None, config=None, config_section=None, initialize=False):
self._options = options if options else {}
self._options_prefix = options_prefix if options_prefix else 'ldap_'
self._config = config if config else None
self._config_section = config_section if config_section else 'ldap'
self._cached_objects = {}
if initialize:
self.initialize()
@ -404,6 +405,8 @@ class LdapClient:
uri, dn=binddn, pwd=self._get_option('bindpwd'),
raiseOnError=True
)
# Reset cache
self._cached_objects = {}
return self._conn.connect()
def decode(self, value):