mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Make IPASimpleLDAPObject.get_single_value result overridable.
Add some default overrides. https://fedorahosted.org/freeipa/ticket/3488
This commit is contained in:
committed by
Petr Viktorin
parent
c98cff25ab
commit
8d67acc026
@@ -246,11 +246,18 @@ class IPASimpleLDAPObject(object):
|
|||||||
#
|
#
|
||||||
# FWIW, many entries under cn=config are undefined :-(
|
# FWIW, many entries under cn=config are undefined :-(
|
||||||
|
|
||||||
_SCHEMA_OVERRIDE = CIDict({
|
_SYNTAX_OVERRIDE = CIDict({
|
||||||
'managedtemplate': DN_SYNTAX_OID, # DN
|
'managedtemplate': DN_SYNTAX_OID, # DN
|
||||||
'managedbase': DN_SYNTAX_OID, # DN
|
'managedbase': DN_SYNTAX_OID, # DN
|
||||||
'originscope': DN_SYNTAX_OID, # DN
|
'originscope': DN_SYNTAX_OID, # DN
|
||||||
})
|
})
|
||||||
|
_SINGLE_VALUE_OVERRIDE = CIDict({
|
||||||
|
'nsslapd-ssl-check-hostname': True,
|
||||||
|
'nsslapd-lookthroughlimit': True,
|
||||||
|
'nsslapd-idlistscanlimit': True,
|
||||||
|
'nsslapd-anonlimitsdn': True,
|
||||||
|
'nsslapd-minssf-exclude-rootdse': True,
|
||||||
|
})
|
||||||
|
|
||||||
def __init__(self, uri, force_schema_updates, no_schema=False,
|
def __init__(self, uri, force_schema_updates, no_schema=False,
|
||||||
decode_attrs=True):
|
decode_attrs=True):
|
||||||
@@ -327,8 +334,8 @@ class IPASimpleLDAPObject(object):
|
|||||||
attr = attr.encode('utf-8')
|
attr = attr.encode('utf-8')
|
||||||
|
|
||||||
# Is this a special case attribute?
|
# Is this a special case attribute?
|
||||||
if attr in self._SCHEMA_OVERRIDE:
|
if attr in self._SYNTAX_OVERRIDE:
|
||||||
return self._SCHEMA_OVERRIDE[attr]
|
return self._SYNTAX_OVERRIDE[attr]
|
||||||
|
|
||||||
if self.schema is None:
|
if self.schema is None:
|
||||||
return None
|
return None
|
||||||
@@ -361,6 +368,9 @@ class IPASimpleLDAPObject(object):
|
|||||||
if isinstance(attr, unicode):
|
if isinstance(attr, unicode):
|
||||||
attr = attr.encode('utf-8')
|
attr = attr.encode('utf-8')
|
||||||
|
|
||||||
|
if attr in self._SINGLE_VALUE_OVERRIDE:
|
||||||
|
return self._SINGLE_VALUE_OVERRIDE[attr]
|
||||||
|
|
||||||
if self.schema is None:
|
if self.schema is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user