mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Cache the value of get_ipa_config() in the request context.
There are some operations that fetch the configuration multiple times. This will return a cached value instead of getting it from LDAP over and over. ticket 1023
This commit is contained in:
parent
463d7d2fe8
commit
e1ef080837
@ -632,6 +632,12 @@ class ldap2(CrudBackend, Encoder):
|
||||
def get_ipa_config(self, attrs_list=None):
|
||||
"""Returns the IPA configuration entry (dn, entry_attrs)."""
|
||||
cdn = "%s,%s" % (api.Object.config.get_dn(), api.env.basedn)
|
||||
try:
|
||||
config_entry = getattr(context, 'config_entry')
|
||||
return (cdn, config_entry)
|
||||
except AttributeError:
|
||||
# Not in our context yet
|
||||
pass
|
||||
try:
|
||||
(cdn, config_entry) = self.find_entries(
|
||||
None, attrs_list, base_dn=cdn, scope=self.SCOPE_BASE,
|
||||
@ -642,6 +648,7 @@ class ldap2(CrudBackend, Encoder):
|
||||
for a in self.config_defaults:
|
||||
if a not in config_entry:
|
||||
config_entry[a] = self.config_defaults[a]
|
||||
setattr(context, 'config_entry', config_entry)
|
||||
return (cdn, config_entry)
|
||||
|
||||
def get_schema(self):
|
||||
|
Loading…
Reference in New Issue
Block a user