mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix LDAP object parameter encoding
Parameters in LDAP objects missed an information if they are real LDAP attributes or not. Real LDAP attributes are written to entry_attrs dictionary in plugin callbacks and are being encoded. This causes issues when plugin callbacks does not expect that the parameters values are already encoded for submission to LDAP. This patch introduces a new flag "noattribute" used to mark that a parameter is not an LDAP attribute and thus should not be encoded or added to entry_attrs. Param documentation is improved to describe the meaning of this and other Param flags or attributes. https://fedorahosted.org/freeipa/ticket/2097
This commit is contained in:
@@ -139,15 +139,16 @@ class Create(Method):
|
||||
for option in super(Create, self).get_options():
|
||||
yield option
|
||||
for option in self.obj.params_minus(self.args):
|
||||
attribute = 'virtual_attribute' not in option.flags
|
||||
if 'no_create' in option.flags:
|
||||
continue
|
||||
if 'ask_create' in option.flags:
|
||||
yield option.clone(
|
||||
attribute=True, query=True, required=False,
|
||||
attribute=attribute, query=True, required=False,
|
||||
autofill=False, alwaysask=True
|
||||
)
|
||||
else:
|
||||
yield option.clone(attribute=True)
|
||||
yield option.clone(attribute=attribute)
|
||||
if not self.extra_options_first:
|
||||
for option in super(Create, self).get_options():
|
||||
yield option
|
||||
@@ -183,19 +184,20 @@ class Update(PKQuery):
|
||||
for option in super(Update, self).get_options():
|
||||
yield option
|
||||
for option in self.obj.params_minus_pk():
|
||||
attribute = 'virtual_attribute' not in option.flags
|
||||
if 'no_update' in option.flags:
|
||||
continue
|
||||
if 'ask_update' in option.flags:
|
||||
yield option.clone(
|
||||
attribute=True, query=True, required=False,
|
||||
attribute=attribute, query=True, required=False,
|
||||
autofill=False, alwaysask=True
|
||||
)
|
||||
elif 'req_update' in option.flags:
|
||||
yield option.clone(
|
||||
attribute=True, required=True, alwaysask=False,
|
||||
attribute=attribute, required=True, alwaysask=False,
|
||||
)
|
||||
else:
|
||||
yield option.clone(attribute=True, required=False, autofill=False)
|
||||
yield option.clone(attribute=attribute, required=False, autofill=False)
|
||||
if not self.extra_options_first:
|
||||
for option in super(Update, self).get_options():
|
||||
yield option
|
||||
@@ -224,21 +226,22 @@ class Search(Method):
|
||||
for option in super(Search, self).get_options():
|
||||
yield option
|
||||
for option in self.obj.params_minus(self.args):
|
||||
attribute = 'virtual_attribute' not in option.flags
|
||||
if 'no_search' in option.flags:
|
||||
continue
|
||||
if 'ask_search' in option.flags:
|
||||
yield option.clone(
|
||||
attribute=True, query=True, required=False,
|
||||
attribute=attribute, query=True, required=False,
|
||||
autofill=False, alwaysask=True
|
||||
)
|
||||
elif isinstance(option, parameters.Flag):
|
||||
yield option.clone_retype(
|
||||
option.name, parameters.Bool,
|
||||
attribute=True, query=True, required=False, autofill=False
|
||||
attribute=attribute, query=True, required=False, autofill=False
|
||||
)
|
||||
else:
|
||||
yield option.clone(
|
||||
attribute=True, query=True, required=False, autofill=False
|
||||
attribute=attribute, query=True, required=False, autofill=False
|
||||
)
|
||||
if not self.extra_options_first:
|
||||
for option in super(Search, self).get_options():
|
||||
|
||||
Reference in New Issue
Block a user