summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/config.py
diff options
context:
space:
mode:
authorGabe <redhatrises@gmail.com>2015-09-21 06:55:17 -0600
committerJan Cholasta <jcholast@redhat.com>2015-09-22 08:00:16 +0200
commit65e958fda4aee2e08cd1f7043369710b839476c3 (patch)
tree5015577bfbe5a14033bb84559ec92cd63e3c0e74 /ipalib/plugins/config.py
parenta94f3e5be88aec378e62f8696ca928635e0569a5 (diff)
downloadfreeipa-65e958fda4aee2e08cd1f7043369710b839476c3.tar.gz
freeipa-65e958fda4aee2e08cd1f7043369710b839476c3.tar.xz
freeipa-65e958fda4aee2e08cd1f7043369710b839476c3.zip
Standardize minvalue for ipasearchrecordlimit and ipasesarchsizelimit for unlimited minvalue
https://fedorahosted.org/freeipa/ticket/4023 Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipalib/plugins/config.py')
-rw-r--r--ipalib/plugins/config.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/ipalib/plugins/config.py b/ipalib/plugins/config.py
index f9e99a6e7..86b7ca863 100644
--- a/ipalib/plugins/config.py
+++ b/ipalib/plugins/config.py
@@ -78,11 +78,6 @@ EXAMPLES:
register = Registry()
-def validate_searchtimelimit(ugettext, limit):
- if limit == 0:
- raise ValidationError(name='ipasearchtimelimit', error=_('searchtimelimit must be -1 or > 1.'))
- return None
-
@register()
class config(LDAPObject):
"""
@@ -150,16 +145,16 @@ class config(LDAPObject):
label=_('Default e-mail domain'),
doc=_('Default e-mail domain'),
),
- Int('ipasearchtimelimit', validate_searchtimelimit,
+ Int('ipasearchtimelimit',
cli_name='searchtimelimit',
label=_('Search time limit'),
- doc=_('Maximum amount of time (seconds) for a search (> 0, or -1 for unlimited)'),
+ doc=_('Maximum amount of time (seconds) for a search (-1 or 0 is unlimited)'),
minvalue=-1,
),
Int('ipasearchrecordslimit',
cli_name='searchrecordslimit',
label=_('Search size limit'),
- doc=_('Maximum number of records to search (-1 is unlimited)'),
+ doc=_('Maximum number of records to search (-1 or 0 is unlimited)'),
minvalue=-1,
),
IA5Str('ipausersearchfields',
@@ -268,6 +263,16 @@ class config_mod(LDAPUpdate):
name=k, error=_('attribute "%s" not allowed') % a
)
+ # Set ipasearchrecordslimit to -1 if 0 is used
+ if 'ipasearchrecordslimit' in entry_attrs:
+ if entry_attrs['ipasearchrecordslimit'] is 0:
+ entry_attrs['ipasearchrecordslimit'] = -1
+
+ # Set ipasearchtimelimit to -1 if 0 is used
+ if 'ipasearchtimelimit' in entry_attrs:
+ if entry_attrs['ipasearchtimelimit'] is 0:
+ entry_attrs['ipasearchtimelimit'] = -1
+
for (attr, obj) in (('ipauserobjectclasses', 'user'),
('ipagroupobjectclasses', 'group')):
if attr in entry_attrs: