Defining a New Class
When you define a new class, you need to specify the legal parent classes of your new class, that is, the classes that can contain instances of your new class. The legal parent classes are specified in the possSuperiors and systemPossSuperiors attributes of the new class, as well as in the possible superiors inherited from its superclasses (but not from auxiliary classes).
Be as specific as possible when defining the legal parent classes for the new class. Where do you want users to be able to create instances of your class? For example, specifying "container" as a legal parent will let the user create instances under any of the standard containers (container, organizationalUnit, and so on), while specifying "computer" would allow instances to be created only under instances of the computer object.
To Create a Class
- Choose a name for the class. For information on composing a common-name and an LDAP display name for a new class, see Naming Attributes and Classes.
- Obtain an object identifier (OID) for the class. See Obtaining a Root Object Identifier (OID).
- Choose a "default object category" for the class. See Object Class and Object Category.
- Choose an "object class category" for the class. This indicates whether the class is abstract, structural, or auxiliary. See Structural, Abstract, and Auxiliary Classes.
- Create a new classSchema object. There are a large number of attributes that can be set for an classSchema object. The following attributes are critical to the definition of a new class. For descriptions of these attributes, see Characteristics of Object Classes.
- Classes from which the new class inherits: subClassOf, auxiliaryClass, and systemAuxiliaryClass
- Names and identifiers for the new class: cn, lDAPDisplayName, adminDisplayName, schemaIDGUID, governsID
- Possible attributes of the new class: mustContain, systemMustContain, mayContain, systemMayContain
- Possible parents of the new class: possSuperiors, systemPossSuperiors
- objectClassCategory
- defaultObjectCategory
- defaultHidingValue
- rDnAttId
- defaultSecurityDescriptor
- description – Optional
Note that the classes specified in subClassOf, possSuperiors, systemPossSuperiors, auxiliaryClass, and systemAuxiliaryClass, must exist when the new class is written to the directory; otherwise, the classSchema object will fail to be added to the directory. Similarly, the attributes specified in mustContain, systemMustContain, mayContain, and systemMayContain, must exist or the class creation operation will fail.
- Write the new classSchema object to the directory.
To add an attribute to the mayContain property
- Retrieve the classSchema object for the class you want to modify
- Add the new attribute to the mayContain multi-valued property
- Write the changed classSchema object back to the directory.