summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/hbac.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/hbac.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/hbac.py')
-rw-r--r--ipalib/plugins/hbac.py26
1 files changed, 2 insertions, 24 deletions
diff --git a/ipalib/plugins/hbac.py b/ipalib/plugins/hbac.py
index 55d9d912..d00bcc08 100644
--- a/ipalib/plugins/hbac.py
+++ b/ipalib/plugins/hbac.py
@@ -108,6 +108,7 @@ class hbac(LDAPObject):
'memberhostgroup',
]
uuid_attribute = 'ipauniqueid'
+ rdn_attribute = 'ipauniqueid'
attribute_members = {
'memberuser': ['user', 'group'],
'memberhost': ['host', 'hostgroup'],
@@ -192,24 +193,6 @@ class hbac(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(hbac, 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(hbac)
@@ -218,14 +201,9 @@ class hbac_add(LDAPCreate):
Create a new HBAC rule.
"""
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
- if not dn.startswith('cn='):
- msg = 'HBAC rule with name "%s" already exists' % keys[-1]
- raise errors.DuplicateEntry(message=msg)
# HBAC rules are enabled by default
entry_attrs['ipaenabledflag'] = 'TRUE'
- return ldap.make_dn(
- entry_attrs, self.obj.uuid_attribute, self.obj.container_dn
- )
+ return dn
api.register(hbac_add)