mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Warn user when ipa *-find reach limit
Truncated entries were silently ignored, now a user receives warning. https://fedorahosted.org/freeipa/ticket/4022 Reviewed-By: Petr Spacek <pspacek@redhat.com> Reviewed-By: Gabe Alford <redhatrises@gmail.com>
This commit is contained in:
@@ -331,6 +331,16 @@ class ExternalCommandOutput(PublicMessage):
|
||||
format = _("%(line)s")
|
||||
|
||||
|
||||
class SearchResultTruncated(PublicMessage):
|
||||
"""
|
||||
**13017** Results of LDAP search has been truncated
|
||||
"""
|
||||
|
||||
errno = 13017
|
||||
type = "warning"
|
||||
format = _("Search result has been truncated to configured search limit.")
|
||||
|
||||
|
||||
def iter_messages(variables, base):
|
||||
"""Return a tuple with all subclasses
|
||||
"""
|
||||
|
||||
@@ -35,6 +35,7 @@ from ipalib import output
|
||||
from ipalib.text import _
|
||||
from ipalib.util import json_serialize, validate_hostname
|
||||
from ipalib.capabilities import client_has_capability
|
||||
from ipalib.messages import add_message, SearchResultTruncated
|
||||
from ipapython.dn import DN
|
||||
from ipapython.version import API_VERSION
|
||||
|
||||
@@ -2101,12 +2102,17 @@ class LDAPSearch(BaseLDAPCommand, crud.Search):
|
||||
entries[i] = entry_to_dict(e, **options)
|
||||
entries[i]['dn'] = e.dn
|
||||
|
||||
return dict(
|
||||
result = dict(
|
||||
result=entries,
|
||||
count=len(entries),
|
||||
truncated=truncated,
|
||||
)
|
||||
|
||||
if truncated:
|
||||
add_message(options['version'], result, SearchResultTruncated())
|
||||
|
||||
return result
|
||||
|
||||
def pre_callback(self, ldap, filters, attrs_list, base_dn, scope, *args, **options):
|
||||
assert isinstance(base_dn, DN)
|
||||
return (filters, base_dn, scope)
|
||||
|
||||
Reference in New Issue
Block a user