These functions are leftovers from when the managed entries plugin was
being developed and not widely available. They are no longer needed.
rob
>From 3159ac686fa09b747d3908b8497254bce1b8f337 Mon Sep 17 00:00:00 2001
From: Rob Crittenden <[email protected]>
Date: Tue, 8 Nov 2011 11:33:46 -0500
Subject: [PATCH] Remove calls to has_upg() and has_managed_entries()
At one point in time we couldn't depend on the 389-ds having
the managed entries plugin so this code was added to support
both versions. It is no longer needed.
https://fedorahosted.org/freeipa/ticket/1242
---
ipalib/plugins/user.py | 2 +-
ipaserver/install/dsinstance.py | 30 ------------------------------
ipaserver/plugins/ldap2.py | 22 ----------------------
3 files changed, 1 insertions(+), 53 deletions(-)
diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py
index 273c68f..d0dd8ce 100644
--- a/ipalib/plugins/user.py
+++ b/ipalib/plugins/user.py
@@ -405,7 +405,7 @@ class user_add(LDAPCreate):
if 'gidnumber' not in entry_attrs:
# gidNumber wasn't specified explicity, find out what it should be
- if not options.get('noprivate', False) and ldap.has_upg():
+ if not options.get('noprivate', False):
# User Private Groups - uidNumber == gidNumber
entry_attrs['gidnumber'] = entry_attrs['uidnumber']
else:
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
index 995877c..15de54e 100644
--- a/ipaserver/install/dsinstance.py
+++ b/ipaserver/install/dsinstance.py
@@ -110,26 +110,6 @@ def check_ports():
def is_ds_running(server_id=''):
return ipaservices.knownservices.dirsrv.is_running(instance_name=server_id)
-def has_managed_entries(host_name, dm_password):
- """Check to see if the Managed Entries plugin is available"""
- ldapuri = 'ldap://%s' % ipautil.format_netloc(host_name)
- conn = None
- try:
- conn = ldap2(shared_instance=False, ldap_uri=ldapuri, base_dn='cn=config')
- conn.connect(bind_dn='cn=Directory Manager', bind_pw=dm_password)
- (dn, attrs) = conn.get_entry('cn=Managed Entries,cn=plugins',
- ['*'], time_limit=2, size_limit=3000)
- return True
- except errors.NotFound:
- return False
- except errors.ExecutionError, e:
- logging.critical("Could not connect to the Directory Server on %s" % host_name)
- raise e
- finally:
- if conn.isconnected():
- conn.disconnect()
-
-
INF_TEMPLATE = """
[General]
FullMachineName= $FQHN
@@ -457,8 +437,6 @@ class DsInstance(service.Service):
self._ldap_mod("unique-attributes.ldif", self.sub_dict)
def __config_uidgid_gen(self):
- if not has_managed_entries(self.fqdn, self.dm_password):
- raise errors.NotFound(reason='Missing Managed Entries Plugin')
self._ldap_mod("dna.ldif", self.sub_dict)
def __add_master_entry(self):
@@ -488,23 +466,15 @@ class DsInstance(service.Service):
self._ldap_mod("lockout-conf.ldif")
def __repoint_managed_entries(self):
- if not has_managed_entries(self.fqdn, self.dm_password):
- raise errors.NotFound(reason='Missing Managed Entries Plugin')
self._ldap_mod("repoint-managed-entries.ldif", self.sub_dict)
def __managed_entries(self):
- if not has_managed_entries(self.fqdn, self.dm_password):
- raise errors.NotFound(reason='Missing Managed Entries Plugin')
self._ldap_mod("managed-entries.ldif", self.sub_dict)
def __user_private_groups(self):
- if not has_managed_entries(self.fqdn, self.dm_password):
- raise errors.NotFound(reason='Missing Managed Entries Plugin')
self._ldap_mod("user_private_groups.ldif", self.sub_dict)
def __host_nis_groups(self):
- if not has_managed_entries(self.fqdn, self.dm_password):
- raise errors.NotFound(reason='Missing Managed Entries Plugin')
self._ldap_mod("host_nis_groups.ldif", self.sub_dict)
def __add_enrollment_module(self):
diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py
index 5c40182..05276e6 100644
--- a/ipaserver/plugins/ldap2.py
+++ b/ipaserver/plugins/ldap2.py
@@ -702,28 +702,6 @@ class ldap2(CrudBackend, Encoder):
else:
return self.schema
- def has_upg(self):
- """Returns True/False whether User-Private Groups are enabled.
- This is determined based on whether the UPG Template exists.
- """
-
- upg_dn = str(DN('cn=UPG Definition,cn=Definitions,cn=Managed Entries,cn=etc', api.env.basedn))
-
- try:
- upg_entry = self.conn.search_s(
- upg_dn,
- _ldap.SCOPE_BASE,
- attrlist=['*']
- )[0]
- disable_attr = '(objectclass=disable)'
- if 'originfilter' in upg_entry[1]:
- org_filter = upg_entry[1]['originfilter']
- return not bool(re.search(r'%s' % disable_attr, org_filter[0]))
- else:
- return False
- except _ldap.NO_SUCH_OBJECT, e:
- return False
-
@encode_args(1, 2)
def get_effective_rights(self, dn, entry_attrs):
"""Returns the rights the currently bound user has for the given DN.
--
1.7.6.4
_______________________________________________
Freeipa-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/freeipa-devel