From fa11fd05281c8450264f89a12fb42cb95bb0a03d Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Wed, 18 Apr 2007 08:00:36 +0000
Subject: [PATCH] Add support for specifying the naming attribute in relations.
---
opendj-sdk/opends/src/server/org/opends/server/admin/LDAPProfile.java | 4 ++--
opendj-sdk/opends/resource/admin/admin-ldap.xsd | 14 ++++++++++++--
opendj-sdk/opends/resource/admin/ldapMOProfile.xsl | 15 +++++++++++++++
3 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/opendj-sdk/opends/resource/admin/admin-ldap.xsd b/opendj-sdk/opends/resource/admin/admin-ldap.xsd
index c16bf54..59e4264 100644
--- a/opendj-sdk/opends/resource/admin/admin-ldap.xsd
+++ b/opendj-sdk/opends/resource/admin/admin-ldap.xsd
@@ -19,7 +19,8 @@
<xsd:documentation>A numeric OID.</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:token">
- <xsd:pattern value="([0-9]+(\.[0-9]+)*)|([a-zA-Z][a-zA-Z0-9\-_]*-oid)" />
+ <xsd:pattern
+ value="([0-9]+(\.[0-9]+)*)|([a-zA-Z][a-zA-Z0-9\-_]*-oid)" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="name-type">
@@ -91,9 +92,18 @@
</xsd:sequence>
</xsd:complexType>
</xsd:element>
+ <xsd:element name="naming-attribute" type="tns:name-type">
+ <xsd:annotation>
+ <xsd:documentation>
+ Defines which LDAP attribute should be used to name child
+ managed objects referenced by a relation. When not specified,
+ "cn" is used by default.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
<xsd:element name="rdn-sequence" type="xsd:token">
<xsd:annotation>
<xsd:documentation>A sequence of RDNs.</xsd:documentation>
</xsd:annotation>
</xsd:element>
-</xsd:schema>
\ No newline at end of file
+</xsd:schema>
diff --git a/opendj-sdk/opends/resource/admin/ldapMOProfile.xsl b/opendj-sdk/opends/resource/admin/ldapMOProfile.xsl
index 3e8bcc4..60c8d08 100644
--- a/opendj-sdk/opends/resource/admin/ldapMOProfile.xsl
+++ b/opendj-sdk/opends/resource/admin/ldapMOProfile.xsl
@@ -77,6 +77,21 @@
'=',
normalize-space(adm:profile[@name='ldap']/ldap:rdn-sequence),
'
')" />
+ <xsl:choose>
+ <xsl:when
+ test="adm:profile[@name='ldap']/ldap:naming-attribute">
+ <xsl:value-of
+ select="concat('naming-attribute.',
+ normalize-space(@name),
+ '=',
+ normalize-space(adm:profile[@name='ldap']/ldap:naming-attribute),
+ '
')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
+ select="concat('naming-attribute.', normalize-space(@name), '=cn
')" />
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
diff --git a/opendj-sdk/opends/src/server/org/opends/server/admin/LDAPProfile.java b/opendj-sdk/opends/src/server/org/opends/server/admin/LDAPProfile.java
index e74c361..a56155e 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/admin/LDAPProfile.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/admin/LDAPProfile.java
@@ -79,8 +79,8 @@
*/
public String getInstantiableRelationChildRDNType(
InstantiableRelationDefinition<?, ?> r) {
- // For now, assume always "cn".
- return "cn";
+ return resource.getString(r.getParentDefinition(),
+ "naming-attribute." + r.getName());
}
--
Gitblit v1.10.0