summaryrefslogtreecommitdiffstats
path: root/ipalib/crud.py
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2011-11-14 17:03:44 +0100
committerMartin Kosek <mkosek@redhat.com>2011-11-15 13:17:44 +0100
commit2a3a4ae64a9c3fa41520058e24f20f4d3d941e48 (patch)
tree3c51f7b993602df309269244c429f85974b86ec2 /ipalib/crud.py
parent714b0d11ec5e6d756739bfca2cdf3bad31979615 (diff)
downloadfreeipa-2a3a4ae64a9c3fa41520058e24f20f4d3d941e48.tar.gz
freeipa-2a3a4ae64a9c3fa41520058e24f20f4d3d941e48.tar.xz
freeipa-2a3a4ae64a9c3fa41520058e24f20f4d3d941e48.zip
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
Diffstat (limited to 'ipalib/crud.py')
-rw-r--r--ipalib/crud.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/ipalib/crud.py b/ipalib/crud.py
index 97d6430d7..833914cfa 100644
--- a/ipalib/crud.py
+++ b/ipalib/crud.py
@@ -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():