diff options
-rw-r--r-- | ipalib/messages.py | 10 | ||||
-rw-r--r-- | ipalib/plugins/baseldap.py | 8 |
2 files changed, 17 insertions, 1 deletions
diff --git a/ipalib/messages.py b/ipalib/messages.py index 078e13f59..e43584b10 100644 --- a/ipalib/messages.py +++ b/ipalib/messages.py @@ -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 """ diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py index 5f7b7fba1..03a255ca1 100644 --- a/ipalib/plugins/baseldap.py +++ b/ipalib/plugins/baseldap.py @@ -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) |