mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Idviews: fix objectclass violation on idview-add
When the option --domain-resolution-order is used with the command ipa idview-add, the resulting LDAP object stores the value in ipadomainresolutionorder attribute. The issue is that the add command does not add the needed object class (ipaNameResolutionData) because it is part of possible_objectclasses but not of object_class. The fix makes sure to add the objectclass when the option --domain-resolution-order is used, and adds a non-regression test. Note that idview-mod does not have any issue as it correctly handles the addition of missing possible objectclasses. Fixes: https://pagure.io/freeipa/issue/7350 Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
committed by
Christian Heimes
parent
beb6d74b81
commit
830866d68a
@@ -22,10 +22,11 @@ import re
|
||||
import six
|
||||
|
||||
from .baseldap import (LDAPQuery, LDAPObject, LDAPCreate,
|
||||
LDAPDelete, LDAPUpdate, LDAPSearch,
|
||||
LDAPAddAttributeViaOption,
|
||||
LDAPRemoveAttributeViaOption,
|
||||
LDAPRetrieve, global_output_params)
|
||||
LDAPDelete, LDAPUpdate, LDAPSearch,
|
||||
LDAPAddAttributeViaOption,
|
||||
LDAPRemoveAttributeViaOption,
|
||||
LDAPRetrieve, global_output_params,
|
||||
add_missing_object_class)
|
||||
from .hostgroup import get_complete_hostgroup_member_list
|
||||
from ipalib import (
|
||||
api, Str, Int, Flag, _, ngettext, errors, output
|
||||
@@ -173,6 +174,12 @@ class idview_add(LDAPCreate):
|
||||
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
|
||||
self.api.Object.config.validate_domain_resolution_order(entry_attrs)
|
||||
|
||||
# The objectclass ipaNameResolutionData may not be present on
|
||||
# the id view. We need to add it if we define a new
|
||||
# value for ipaDomainResolutionOrder
|
||||
if 'ipadomainresolutionorder' in entry_attrs:
|
||||
add_missing_object_class(ldap, u'ipanameresolutiondata', dn,
|
||||
entry_attrs, update=False)
|
||||
return dn
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user