PingDirectory

Adding a new attribute to the schema over LDAP

Steps

  1. In a text editor, create an LDIF file with the new attribute definition.

    Example:

    In this example, the LDIF file is named myschema.ldif.

    dn: cn=schema
    changetype: modify
    add: attributeTypes
    attributeTypes: ( contractorStatus-OID NAME 'contractorStatus'
      EQUALITY booleanMatch
      SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
      SINGLE-VALUE
      USAGE userApplications
      X-ALLOWED-VALUES ( ’Y’ ’N’ ’y’ ’n’ )
      X-ORIGIN 'PingDirectory Server Example' )
  2. To add the attribute, run ldapmodify.

    Example:

    $ bin/ldapmodify --filename myschema.ldif
  3. To verify the addition, display the attribute using ldapsearch.

    $ bin/ldapsearch --baseDN cn=schema --searchScope base \
      --dontwrap "(objectclass=*)" attributeTypes | grep 'contractorStatus'
  4. To view the custom schema file, go to <server-root>/config/schema/99-user.ldif.

    Result:

    For this example, you see the following details:

    dn: cn=schema
    objectClass: top
    objectClass: ldapSubentry
    objectClass: subschema
    cn: schema
    attributeTypes: ( contractorStatus-OID
      NAME 'contractorStatus'
      EQUALITY booleanMatch
      SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
      SINGLE-VALUE
      USAGE userApplications
      X-ORIGIN 'PingDirectory Server Example' )