Extending the schema using a custom schema file
To add new attributes and object classes to your PingDirectory server schema, create a custom schema file.
Steps
-
Create an LDIF file with the new attribute extensions using a text editor.
Example:
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' )
-
In the LDIF file you created in step 1, add a new object class definition after the attribute types.
Example:
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' )
-
Save the file and place it in the
<server-root>/config/schema
directory.In this example, the file is saved as
99-auxobjclass.ldif
. -
Load the schema extensions into the PingDirectory server. You have four options:
Choose from:
-
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 usingldapmodify
.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
When using this method, you don’t need to restart the server.
-
Import the schema file using the Administrative Console Schema Editor.
When using this method, you don’t need to restart the server.
-
Place the
99-auxobjclass.ldif
file in the<server-root>/config/schema
directory. -
Restart PingDirectory server.
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
When using this method, you don’t need to restart the server.
-
-
Add the new object class and attribute to an existing user entry.
Example:
$ bin/ldapmodify dn: uid=user.9,ou=People,dc=example,dc=com changetype: modify add: objectClass objectClass: contractor - add: contractorStatus contractorStatus: TRUE
-
To verify the addition, run
ldapsearch
to display the attribute.Example:
$ bin/ldapsearch --baseDN dc=example,dc=com "(uid=user.9)" contractorStatus
Result:
dn: uid=user.9,ou=People,dc=example,dc=com contractorStatus: TRUE