mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

matthew_swift
18.00.2007 e7082916645d9f30c4688bdaacc17def57bd8126
Add support for specifying the naming attribute in relations.
3 files modified
31 ■■■■■ changed files
opends/resource/admin/admin-ldap.xsd 12 ●●●●● patch | view | raw | blame | history
opends/resource/admin/ldapMOProfile.xsl 15 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/LDAPProfile.java 4 ●●●● patch | view | raw | blame | history
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,6 +92,15 @@
      </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>
opends/resource/admin/ldapMOProfile.xsl
@@ -77,6 +77,21 @@
                       '=',
                       normalize-space(adm:profile[@name='ldap']/ldap:rdn-sequence),
                       '&#xa;')" />
      <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),
                       '&#xa;')" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of
            select="concat('naming-attribute.', normalize-space(@name), '=cn&#xa;')" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>
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());
  }