| |
@@ -100,17 +100,100 @@
|
| |
|
| |
|
| |
class AddnPlugin(Plugin):
|
| |
- """An instance of addn plugin entry
|
| |
+ """An instance of ADDN plugin entry
|
| |
|
| |
:param instance: An instance
|
| |
:type instance: lib389.DirSrv
|
| |
:param dn: Entry DN
|
| |
:type dn: str
|
| |
"""
|
| |
+ _plugin_properties = {
|
| |
+ 'nsslapd-pluginEnabled': 'off',
|
| |
+ 'nsslapd-pluginPath': 'libaddn-plugin',
|
| |
+ 'nsslapd-pluginInitfunc': 'addn_init',
|
| |
+ 'nsslapd-pluginType': 'preoperation',
|
| |
+ 'nsslapd-pluginId': 'addn',
|
| |
+ 'nsslapd-pluginVendor': '389 Project',
|
| |
+ 'nsslapd-pluginVersion': 'none',
|
| |
+ 'nsslapd-pluginDescription': 'Allow AD DN style bind names to LDAP',
|
| |
+ }
|
| |
|
| |
def __init__(self, instance, dn="cn=addn,cn=plugins,cn=config"):
|
| |
super(AddnPlugin, self).__init__(instance, dn)
|
| |
- # Need to add wrappers to add domains to this.
|
| |
+ self._create_objectclasses = ['top', 'nsslapdplugin', 'extensibleObject']
|
| |
+
|
| |
+ def set_default_domain(self, attr):
|
| |
+ """Add addn_default_domain attribute"""
|
| |
+
|
| |
+ self.set('addn_default_domain', attr)
|
| |
+
|
| |
+ def get_default_domain(self):
|
| |
+ """Get addn_default_domain attribute"""
|
| |
+
|
| |
+ return self.get_attr_val_utf8('addn_default_domain')
|
| |
+
|
| |
+ class AddnDomain(DSLdapObject):
|
| |
+ """A single instance of ADDN plugin domain config entry
|
| |
+
|
| |
+ :param instance: An instance
|
| |
+ :type instance: lib389.DirSrv
|
| |
+ :param dn: Entry DN
|
| |
+ :type dn: str
|
| |
+ """
|
| |
+
|
| |
+ def __init__(self, instance, dn):
|
| |
+ super(AddnDomain, self).__init__(instance, dn)
|
| |
+ self._rdn_attribute = 'cn'
|
| |
+ self._must_attributes = ['cn','addn_base', 'addn_filter']
|
| |
+ self._create_objectclasses = ['top', 'extensibleObject']
|
| |
+ self._protected = False
|
| |
+
|
| |
+ class AddnDomains(DSLdapObjects):
|
| |
+ """A DSLdapObjects entity which represents ADDN plugin domain config entry
|
| |
+
|
| |
+ :param instance: An instance
|
| |
+ :type instance: lib389.DirSrv
|
| |
+ :param basedn: Base DN for all account entries below
|
| |
+ :type basedn: str
|
| |
+ """
|
| |
+
|
| |
+ def __init__(self, instance, basedn=None):
|
| |
+ super(AddnDomains, self).__init__(instance)
|
| |
+ self._objectclasses = ['top', 'extensibleObject']
|
| |
+ self._filterattrs = ['cn']
|
| |
+ self._childobject = AddnDomain
|
| |
+ # So we can set the configArea easily
|
| |
+ if basedn is None:
|
| |
+ basedn = "cn=addn,cn=plugins,cn=config"
|
| |
+ self._basedn = basedn
|
| |
+
|
| |
+ def list(self):
|
| |
+ """Get a list of children entries (DSLdapObject, Replica, etc.) using a base DN
|
| |
+ and objectClasses of our object (DSLdapObjects, Replicas, etc.)
|
| |
+
|
| |
+ :returns: A list of children entries
|
| |
+ """
|
| |
+
|
| |
+ # Filter based on the objectclasses and the basedn
|
| |
+ insts = None
|
| |
+ # This will yield and & filter for objectClass with as many terms as needed.
|
| |
+ filterstr = self._get_objectclass_filter()
|
| |
+ self._log.debug('list filter = %s' % filterstr)
|
| |
+ try:
|
| |
+ results = self._instance.search_ext_s(
|
| |
+ base=self._basedn,
|
| |
+ scope=self._scope,
|
| |
+ filterstr=filterstr,
|
| |
+ attrlist=self._list_attrlist,
|
| |
+ serverctrls=self._server_controls, clientctrls=self._client_controls,
|
| |
+ escapehatch='i am sure'
|
| |
+ )
|
| |
+ # def __init__(self, instance, dn=None):
|
| |
+ insts = [self._entry_to_instance(dn=r.dn, entry=r) for r in results]
|
| |
+ except ldap.NO_SUCH_OBJECT:
|
| |
+ # There are no objects to select from, se we return an empty array
|
| |
+ insts = []
|
| |
+ return insts
|
| |
|
| |
|
| |
class AttributeUniquenessPlugin(Plugin):
|
| |
@@ -1016,7 +1099,7 @@
|
| |
|
| |
|
| |
class SevenBitCheckPlugin(Plugin):
|
| |
- """An instance of addn plugin entry
|
| |
+ """An instance of 7-bit check plugin entry
|
| |
|
| |
:param instance: An instance
|
| |
:type instance: lib389.DirSrv
|
| |
Description:
Relates: https://pagure.io/389-ds-base/issue/50396
Reviewed by: ???