summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-08-10 16:24:10 -0400
committerJason Gerard DeRose <jderose@redhat.com>2009-08-10 16:38:42 -0600
commitc781e8a57d3d05fa07729dbccff07bc1fab9d8e8 (patch)
treea34808ae88abc0a6c61414ca9eda9a094736ba6b /ipalib
parentdbeb409ebd0396ce58102b118452c6e4c6802937 (diff)
downloadfreeipa-c781e8a57d3d05fa07729dbccff07bc1fab9d8e8.tar.gz
freeipa-c781e8a57d3d05fa07729dbccff07bc1fab9d8e8.tar.xz
freeipa-c781e8a57d3d05fa07729dbccff07bc1fab9d8e8.zip
Add a new objectclass, ipaObject, that will add a UUID to many IPA objects
ipaObject is defined as an auxiliary objectclass so it is up to the plugin author to ensure that the objectclass is included an a UUID generated. ipaUniqueId is a MUST attribute so if you include the objectclass you must ensure that the uuid is generated. This also fixes up some unrelated unit test failures.
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/plugins/basegroup.py5
-rw-r--r--ipalib/plugins/host.py5
-rw-r--r--ipalib/plugins/netgroup.py4
-rw-r--r--ipalib/plugins/service.py4
-rw-r--r--ipalib/plugins/user.py3
5 files changed, 16 insertions, 5 deletions
diff --git a/ipalib/plugins/basegroup.py b/ipalib/plugins/basegroup.py
index edcc9999..9cfd3506 100644
--- a/ipalib/plugins/basegroup.py
+++ b/ipalib/plugins/basegroup.py
@@ -25,6 +25,7 @@ Base plugin for groups.
from ipalib import api, crud, errors
from ipalib import Command, Object
from ipalib import Flag, Int, List, Str
+from ipalib import uuid
_default_attributes = ['cn', 'description', 'member', 'memberof']
_default_class = 'groupofnames'
@@ -137,7 +138,7 @@ class basegroup_add(crud.Create):
"""
Create new group.
"""
- base_classes = ('top', _default_class)
+ base_classes = ('top', 'ipaobject', _default_class)
def execute(self, cn, **kw):
"""
@@ -162,6 +163,8 @@ class basegroup_add(crud.Create):
else:
entry_attrs['objectclass'] = self.base_classes
+ entry_attrs['ipauniqueid'] = str(uuid.uuid1())
+
ldap.add_entry(dn, entry_attrs)
return ldap.get_entry(dn, entry_attrs.keys())
diff --git a/ipalib/plugins/host.py b/ipalib/plugins/host.py
index fe46d2d5..809ec319 100644
--- a/ipalib/plugins/host.py
+++ b/ipalib/plugins/host.py
@@ -29,6 +29,7 @@ from ipalib import api, crud, errors, util
from ipalib import Object
from ipalib import Str, Flag
from ipalib.plugins.service import split_principal
+from ipalib import uuid
_container_dn = api.env.container_host
_default_attributes = [
@@ -166,7 +167,7 @@ class host_add(crud.Create):
# FIXME: add this attribute to cn=ipaconfig
# config = ldap.get_ipa_config()[1]
# kw['objectclass'] = config.get('ipahostobjectclasses')
- entry_attrs['objectclass'] = ['nshost', 'ipahost', 'pkiuser']
+ entry_attrs['objectclass'] = ['ipaobject', 'nshost', 'ipahost', 'pkiuser']
if 'userpassword' not in entry_attrs:
entry_attrs['krbprincipalname'] = 'host/%s@%s' % (
@@ -178,6 +179,8 @@ class host_add(crud.Create):
elif 'krbprincipalaux' in entry_attrs['objectclass']:
entry_attrs['objectclass'].remove('krbprincipalaux')
+ entry_attrs['ipauniqueid'] = str(uuid.uuid1())
+
ldap.add_entry(dn, entry_attrs)
return ldap.get_entry(dn, entry_attrs.keys())
diff --git a/ipalib/plugins/netgroup.py b/ipalib/plugins/netgroup.py
index 9a2d750c..4aac0271 100644
--- a/ipalib/plugins/netgroup.py
+++ b/ipalib/plugins/netgroup.py
@@ -69,9 +69,9 @@ class netgroup_add(basegroup_add):
ldap = self.api.Backend.ldap2
entry_attrs = self.args_options_2_entry(cn, **kw)
- entry_attrs['ipauniqueid'] = str(uuid.uuid1())
- entry_attrs['objectclass'] = ['top', 'ipaassociation', _default_class]
+ entry_attrs['objectclass'] = ['top', 'ipaobject', 'ipaassociation', _default_class]
entry_attrs.setdefault('nisdomainname', self.api.env.domain)
+ entry_attrs['ipauniqueid'] = str(uuid.uuid1())
dn = ldap.make_dn(entry_attrs, 'ipauniqueid', _container_dn)
diff --git a/ipalib/plugins/service.py b/ipalib/plugins/service.py
index 03204acb..8d852ca4 100644
--- a/ipalib/plugins/service.py
+++ b/ipalib/plugins/service.py
@@ -28,6 +28,7 @@ from OpenSSL import crypto
from ipalib import api, crud, errors
from ipalib import Object
from ipalib import Str, Flag, Bytes
+from ipalib import uuid
_container_dn = api.env.container_service
_default_attributes = ['krbprincipalname', 'usercertificate']
@@ -152,8 +153,9 @@ class service_add(crud.Create):
entry_attrs = self.args_options_2_entry(principal, **kw)
entry_attrs['objectclass'] = [
'krbprincipal', 'krbprincipalaux', 'krbticketpolicyaux',
- 'ipaservice', 'pkiuser'
+ 'ipaobject', 'ipaservice', 'pkiuser'
]
+ entry_attrs['ipauniqueid'] = str(uuid.uuid1())
dn = ldap.make_dn(entry_attrs, 'krbprincipalname', _container_dn)
ldap.add_entry(dn, entry_attrs)
diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py
index 2b4ec521..e48a408c 100644
--- a/ipalib/plugins/user.py
+++ b/ipalib/plugins/user.py
@@ -24,6 +24,7 @@ Users (Identity)
from ipalib import api, crud, errors
from ipalib import Command, Object
from ipalib import Flag, Int, Password, Str
+from ipalib import uuid
# parent DN
_container_dn = api.env.container_user
@@ -151,6 +152,8 @@ class user_add(crud.Create):
# fill default group's gidNumber
entry_attrs['gidnumber'] = group_attrs['gidnumber']
+ entry_attrs['ipauniqueid'] = str(uuid.uuid1())
+
# create user entry
ldap.add_entry(dn, entry_attrs)