Univention Bugzilla – Bug 51777
Searching udm attributes which have complex syntax *and* are multivalue never yields results
Last modified: 2024-01-04 20:57:32 CET
Created attachment 10451 [details] fix filter for complex multivalue attributes In a customer project, we created an attribute, which has a complex syntax class, consisting out of three simple syntaxes. This attribute is also multivalue. Wenn searching the attribute like this: udm users/user list --filter complexmultiattribut=* no result is found even though there are results to be found. This happens due to the constructed filter by udm looking something like this: "(&(univentionObjectType=users/user)(!(uidNumber=0))(!(univentionObjectFlag=functional))(complexmultiattribut=['*']))" instead of: "(&(univentionObjectType=users/user)(!(uidNumber=0))(!(univentionObjectFlag=functional))(complexmultiattribut=*))" The attached patch seems to fix this issue. But I am not sure if this is a correct solution.
Do we have affected properties in the product? Extended attributes are a special case here. Regulary the mapping should have transformed it into a ldap-suitable representation: 1826 » » » filter.value = mapping.mapValueDecoded(key, filter.value) → This should have done the trick, but seems not working for extended attributes which don't have a mapping for complex syntaxes? The following block is also only partly correct: 1828 » » if isinstance(filter.value, (list, tuple)) and filter.value: 1829 » » » # complex syntax 1830 » » » filter.value = filter.value[0] → multiple values should be considered. See git:b18bcff310551223ebbf4fc551371eca35e96c72 for the reason why it was introduced. Maybe we can go with something like this: if isinstance(filter.value, (list, tuple)) and filter.value: + if isinstance(filter.value[0], (list, tuple)): + filter.value = [mapping.mapValueDecoded(key, val) for val in filter.value] # complex syntax - filter.value = filter.value[0] + filter.transform_to_conjunction(univention.admin.filter.conjunction(u'&', [univention.admin.filter.expression(filter.variable, val, escape=True) for val in filter.value]))
Changed module: univention-directory-manager-modules
(In reply to Jan Luttermann from comment #3) > Changed module: univention-directory-manager-modules When you change a bug to RESOLVED FIXED, please: * write a summary of what you did. Explain the details of the change. * list the changed commits (e.g. with toolshed:gitlog) REOPEN: The change backported things from UCS 5 which changes the API of UDM to return unicode instead of str. This caused some Jenkins Tests to fail: https://jenkins.knut.univention.de:8181/job/UCS-4.4/job/UCS-4.4-6/job/AutotestUpgrade/lastCompletedBuild/SambaVersion=s4,Systemrolle=master-part-II/testReport/99_end/01_var_log_tracebacks/master071/ https://jenkins.knut.univention.de:8181/job/UCS-4.4/job/UCS-4.4-6/job/AutotestJoin/lastCompletedBuild/SambaVersion=no-samba,Systemrolle=master-part-II/testReport/86_selenium/17_self_service_registration/master090/ https://jenkins.knut.univention.de:8181/job/UCS-4.4/job/UCS-4.4-6/job/AutotestJoin/lastCompletedBuild/SambaVersion=no-samba,Systemrolle=master-part-II/testReport/86_selenium/180_portal_entries/master090/ REOPEN: The YAML description should be a not-too-technical description of the change from an Administrator(customer) point of view. So they should contain complete sentences with correct grammar and avoid terms like "Fixed". + * Fixing filter functionality for multivalue + attributes.
I had to revert the complete changes, as this breaks the Portal tests. udm settings/portal_entry list --filter="portal=cn=domain,cn=portal,cn=univention,$(ucr get ldap/base)" → with the patch this yields no entries anymore. univention-directory-manager-modules (14.0.16-8) 9e5a06923aad | Revert "Bug #51777: fixed filter functionality for multivalue attributes"
fixed with MR 60 and 59. added tests for all relevant modules
Affected properties (removed duplicates): >>> import univention.admin.modules >>> univention.admin.modules.update() >>> for i in [(name, pname, prop.syntax.name) for name, module in univention.admin.modules.modules.items() for pname, prop in module.property_descriptions.items() if prop.multivalue and isinstance(prop.syntax, univention.admin.syntax.compl ex)]: ... print(i) # module, property, syntax ('settings/udm_syntax', 'messagecatalog', 'Localesubdirname_and_GNUMessageCatalog') ('settings/extended_attribute', 'translationShortDescription', 'translationTupleShortDescription') ('settings/extended_attribute', 'translationLongDescription', 'translationTupleLongDescription') ('settings/extended_attribute', 'translationTabName', 'translationTupleTabName') ('settings/extended_attribute', 'translationGroupName', 'I18N_GroupName') ('settings/udm_hook', 'messagecatalog', 'Localesubdirname_and_GNUMessageCatalog') ('settings/printermodel', 'printmodel', 'printerModel') ('settings/portal_all', 'displayName', 'LocalizedDisplayName') ('settings/udm_module', 'messagecatalog', 'Localesubdirname_and_GNUMessageCatalog') ('settings/udm_module', 'umcmessagecatalog', 'UMCMessageCatalogFilename_and_GNUMessageCatalog') ('settings/extended_options', 'translationShortDescription', 'translationTupleShortDescription') ('settings/extended_options', 'translationLongDescription', 'translationTupleLongDescription') ('settings/umc_operationset', 'operation', 'UMC_CommandPattern') ('dhcp/pool', 'range', 'IPv4_AddressRange') ('dhcp/subnet', 'range', 'IPv4_AddressRange') ('dhcp/sharedsubnet', 'range', 'IPv4_AddressRange') ('users/user', 'homePostalAddress', 'postalAddress') ('users/user', 'umcProperty', 'keyAndValue') ('networks/network', 'ipRange', 'IP_AddressRange') ('saml/serviceprovider', 'LDAPattributes', 'attributeMapping') ('shares/share', 'sambaCustomSettings', 'keyAndValue') ('computers/domaincontroller_slave', 'dnsEntryZoneForward', 'dnsEntry') ('computers/domaincontroller_slave', 'dnsEntryZoneReverse', 'dnsEntryReverse') ('computers/domaincontroller_slave', 'dnsEntryZoneAlias', 'dnsEntryAlias') ('computers/domaincontroller_slave', 'dhcpEntryZone', 'dhcpEntry') … duplication in various computer modules ('monitoring/alert', 'labels', 'keyAndValue') ('mail/folder', 'sharedFolderUserACL', 'SharedFolderUserACL') ('mail/folder', 'sharedFolderGroupACL', 'SharedFolderGroupACL') ('dns/host_record', 'mx', 'dnsMX') ('dns/srv_record', 'location', 'dnsSRVLocation') ('dns/forward_zone', 'mx', 'dnsMX') ('portals/category', 'displayName', 'LocalizedDisplayName') ('portals/entry', 'description', 'LocalizedDescription') ('portals/entry', 'keywords', 'LocalizedKeywords') ('portals/entry', 'link', 'LocalizedLink') ('policies/nfsmounts', 'nfsMounts', 'nfsMounts') ('policies/registry', 'registry', 'UCR_Variable')
See also Bug #40672 git:b18bcff310551223ebbf4fc551371eca35e96c72 which adds a special case for complex syntaxes.
Draft which I started long time ago: https://git.knut.univention.de/univention/ucs/-/merge_requests/1009