summaryrefslogtreecommitdiffstats
path: root/ipaserver/plugins/ldap2.py
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-01-18 04:36:45 -0500
committerMartin Kosek <mkosek@redhat.com>2013-03-01 16:59:43 +0100
commit44e15206d03e7e1a47af4280f4d99ce86301d6f3 (patch)
tree1ba0543fa8af093335a54f17bd4ff5e790454d0e /ipaserver/plugins/ldap2.py
parent5476b144f671f87d833f9cb5dbeda3220639d4c8 (diff)
downloadfreeipa-44e15206d03e7e1a47af4280f4d99ce86301d6f3.tar.gz
freeipa-44e15206d03e7e1a47af4280f4d99ce86301d6f3.tar.xz
freeipa-44e15206d03e7e1a47af4280f4d99ce86301d6f3.zip
Move schema-related methods to LDAPConnection
Part of the work for: https://fedorahosted.org/freeipa/ticket/2660
Diffstat (limited to 'ipaserver/plugins/ldap2.py')
-rw-r--r--ipaserver/plugins/ldap2.py49
1 files changed, 5 insertions, 44 deletions
diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py
index 12b815139..28bc88156 100644
--- a/ipaserver/plugins/ldap2.py
+++ b/ipaserver/plugins/ldap2.py
@@ -56,8 +56,6 @@ except ImportError:
class GetEffectiveRightsControl(LDAPControl):
def __init__(self, criticality, authzId=None):
LDAPControl.__init__(self, '1.3.6.1.4.1.42.2.27.9.5.2', criticality, authzId)
-# for backward compatibility
-from ipalib import _
from ipalib import api, errors
from ipalib.crud import CrudBackend
@@ -105,6 +103,11 @@ class ldap2(LDAPConnection, CrudBackend):
except AttributeError:
self.base_dn = DN()
+ def _init_connection(self):
+ # Connectible.conn is a proxy to thread-local storage;
+ # do not set it
+ pass
+
def __del__(self):
if self.isconnected():
self.disconnect()
@@ -112,48 +115,6 @@ class ldap2(LDAPConnection, CrudBackend):
def __str__(self):
return self.ldap_uri
- def _get_schema(self):
- return self.conn.schema
- schema = property(_get_schema, None, None, 'schema associated with this LDAP server')
-
- def get_syntax(self, attr, value):
- if self.schema is None:
- return None
- obj = self.schema.get_obj(_ldap.schema.AttributeType, attr)
- if obj is not None:
- return obj.syntax
- else:
- return None
-
- def has_dn_syntax(self, attr):
- return self.conn.has_dn_syntax(attr)
-
- def get_allowed_attributes(self, objectclasses, raise_on_unknown=False):
- if self.schema is None:
- return None
- allowed_attributes = []
- for oc in objectclasses:
- obj = self.schema.get_obj(_ldap.schema.ObjectClass, oc)
- if obj is not None:
- allowed_attributes += obj.must + obj.may
- elif raise_on_unknown:
- raise errors.NotFound(reason=_('objectclass %s not found') % oc)
- return [unicode(a).lower() for a in list(set(allowed_attributes))]
-
- def get_single_value(self, attr):
- """
- Check the schema to see if the attribute is single-valued.
-
- If the attribute is in the schema then returns True/False
-
- If there is a problem loading the schema or the attribute is
- not in the schema return None
- """
- if self.schema is None:
- return None
- obj = self.schema.get_obj(_ldap.schema.AttributeType, attr)
- return obj and obj.single_value
-
def create_connection(self, ccache=None, bind_dn=None, bind_pw='',
tls_cacertfile=None, tls_certfile=None, tls_keyfile=None,
debug_level=0, autobind=False):