summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/netgroup.py
diff options
context:
space:
mode:
authorPavel Zuna <pzuna@redhat.com>2010-10-27 13:04:06 -0400
committerSimo Sorce <ssorce@redhat.com>2010-10-28 07:58:31 -0400
commit93290c8a72bcd5c4ab34eedf0ec443469b36f8c1 (patch)
tree0b0f4461c3c34062356f16d43643a945157343b8 /ipalib/plugins/netgroup.py
parentc51ce61e4d295cc49a28768231a8d72d9a78f45b (diff)
downloadfreeipa-93290c8a72bcd5c4ab34eedf0ec443469b36f8c1.tar.gz
freeipa-93290c8a72bcd5c4ab34eedf0ec443469b36f8c1.tar.xz
freeipa-93290c8a72bcd5c4ab34eedf0ec443469b36f8c1.zip
Add LDAPObject setting to handle different attributes for RDN and PKEY.
Diffstat (limited to 'ipalib/plugins/netgroup.py')
-rw-r--r--ipalib/plugins/netgroup.py25
1 files changed, 1 insertions, 24 deletions
diff --git a/ipalib/plugins/netgroup.py b/ipalib/plugins/netgroup.py
index 144505be..9edc45e5 100644
--- a/ipalib/plugins/netgroup.py
+++ b/ipalib/plugins/netgroup.py
@@ -76,6 +76,7 @@ class netgroup(LDAPObject):
'nisdomainname', 'memberuser', 'memberhost',
]
uuid_attribute = 'ipauniqueid'
+ rdn_attribute = 'ipauniqueid'
attribute_members = {
'memberof': ['netgroup'],
'memberuser': ['user', 'group'],
@@ -108,24 +109,6 @@ class netgroup(LDAPObject):
),
)
- def get_dn(self, *keys, **kwargs):
- try:
- (dn, entry_attrs) = self.backend.find_entry_by_attr(
- self.primary_key.name, keys[-1], self.object_class, [''],
- self.container_dn
- )
- except errors.NotFound:
- dn = super(netgroup, self).get_dn(*keys, **kwargs)
- return dn
-
- def get_primary_key_from_dn(self, dn):
- pkey = self.primary_key.name
- (dn, entry_attrs) = self.backend.get_entry(dn, [pkey])
- try:
- return entry_attrs[pkey][0]
- except (KeyError, IndexError):
- return ''
-
api.register(netgroup)
@@ -135,13 +118,7 @@ class netgroup_add(LDAPCreate):
"""
has_output_params = output_params
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
- if not dn.startswith('cn='):
- msg = 'netgroup with name "%s" already exists' % keys[-1]
- raise errors.DuplicateEntry(message=msg)
entry_attrs.setdefault('nisdomainname', self.api.env.domain)
- dn = ldap.make_dn(
- entry_attrs, self.obj.uuid_attribute, self.obj.container_dn
- )
return dn
api.register(netgroup_add)