Extending the schema using a custom schema file - PingDirectory - 9.3

PingDirectory 9.3

bundle
pingdirectory-93
ft:publication_title
PingDirectory 9.3
Product_Version_ce
PingDirectory 9.3 (Latest)
category
Product
pd-93
pingdirectory
ContentType_ce

To add new attributes and object classes to your PingDirectory server schema, create a custom schema file.

  1. Create an LDIF file with the new attribute extensions using a text editor.
    dn: cn=schema 
    objectClass: top 
    objectClass: ldapSubentry 
    objectClass: subschema 
    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 'Directory Server Example' )
    attributeTypes: ( contractorAgency-OID NAME 'contractorAgency' 
      EQUALITY caseIgnoreMatch 
      SUBSTR caseIgnoreSubstringsMatch 
      SYNTAX 1.3.6.1.4.1.1466.115.121.1.44{256}
      SINGLE-VALUE 
      USAGE userApplications 
      X-ORIGIN 'PingDirectory Server Example' )
  2. In the LDIF file you created in step 1, add a new object class definition after the attribute types.

    This example creates an auxiliary object class, contractor, that alone cannot be used as an entry.

    The object class is used to add supplemental information to the inetOrgPerson structural object class. The attributes are all optional for the new object class.

    objectClasses: ( contractor-OID 
      NAME 'contractor' 
      DESC 'Contractor status information' 
      SUP top 
      AUXILIARY
      MAY ( contractorStatus $ contractorAgency ) 
      X-ORIGIN 'PingDirectory Server Example' )
  3. Save the file and place it in the <server-root>/config/schema directory.

    In this example, the file is saved as 99-auxobjclass.ldif.

  4. Load the schema extensions into the PingDirectory server. You have four options:
    • Create a task that loads the new extensions into the schema.

      The following example creates a task with the ID add-schema-99-auxobjclass and adds it using ldapmodify.

      dn: ds-task-id=add-schema-99-auxobjclass,cn=Scheduled Tasks,cn=tasks 
      objectClass: top 
      objectClass: ds-task 
      objectClass: ds-task-add-schema-file
      ds-task-id: add-schema-99-auxobjclass 
      ds-task-class-name: com.unboundid.directory.server.tasks.AddSchemaFileTask 
      ds-task-schema-file-name: 99-auxobjclass.ldif
      Note:

      When using this method, you don't need to restart the server.

    • Import the schema file using the Administrative Console Schema Editor.
      Note:

      When using this method, you don't need to restart the server.

      1. Place the 99-auxobjclass.ldif file in the <server-root>/config/schema directory.
      2. Restart PingDirectory server.
      Note:

      The schema file is read at startup.

    • Add the schema file using load-ldap-schema-file.
      $ bin/load-ldap-schema-file --schemaFile config/schema 99-auxobjclass.ldif
      Note:

      When using this method, you don't need to restart the server.

  5. Add the new object class and attribute to an existing user entry.
    $ bin/ldapmodify
    dn: uid=user.9,ou=People,dc=example,dc=com
    changetype: modify
    add: objectClass
    objectClass: contractor
    -
    add: contractorStatus
    contractorStatus: TRUE
  6. To verify the addition, run ldapsearch to display the attribute.
    $ bin/ldapsearch --baseDN dc=example,dc=com "(uid=user.9)" contractorStatus
    dn: uid=user.9,ou=People,dc=example,dc=com 
    contractorStatus: TRUE