LdapClient: init cache in __init__ method and reset it during initialization
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
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:
parent
e7e07a944a
commit
ade97bc90f
1 changed files with 4 additions and 1 deletions
|
@ -346,13 +346,14 @@ class LdapClient:
|
||||||
_conn = None
|
_conn = None
|
||||||
|
|
||||||
# Cache objects
|
# Cache objects
|
||||||
_cached_objects = dict()
|
_cached_objects = None
|
||||||
|
|
||||||
def __init__(self, options=None, options_prefix=None, config=None, config_section=None, initialize=False):
|
def __init__(self, options=None, options_prefix=None, config=None, config_section=None, initialize=False):
|
||||||
self._options = options if options else {}
|
self._options = options if options else {}
|
||||||
self._options_prefix = options_prefix if options_prefix else 'ldap_'
|
self._options_prefix = options_prefix if options_prefix else 'ldap_'
|
||||||
self._config = config if config else None
|
self._config = config if config else None
|
||||||
self._config_section = config_section if config_section else 'ldap'
|
self._config_section = config_section if config_section else 'ldap'
|
||||||
|
self._cached_objects = {}
|
||||||
if initialize:
|
if initialize:
|
||||||
self.initialize()
|
self.initialize()
|
||||||
|
|
||||||
|
@ -404,6 +405,8 @@ class LdapClient:
|
||||||
uri, dn=binddn, pwd=self._get_option('bindpwd'),
|
uri, dn=binddn, pwd=self._get_option('bindpwd'),
|
||||||
raiseOnError=True
|
raiseOnError=True
|
||||||
)
|
)
|
||||||
|
# Reset cache
|
||||||
|
self._cached_objects = {}
|
||||||
return self._conn.connect()
|
return self._conn.connect()
|
||||||
|
|
||||||
def decode(self, value):
|
def decode(self, value):
|
||||||
|
|
Loading…
Reference in a new issue