|
||
|
|
This chapter describes how entry type formatsdefined by object classes and their attributescan be controlled by editing parameters in the
dsgw.conffile. The chapter contains the following sections:
- Entry Types (Object Classes)
![]()
- Mapping Locations and Entry Types
![]()
- Object Class Attributes in Template Files
![]()
The following sections describe entry types in detail:
Parameters Controlling Entry Types
The functionality of entry types appearing on gateway forms are controlled by parameters stored in
dsgw.conf:
- Template parameter settings determine the types of objects that can be created and the attributes supported for object classes.
![]()
- Newtype parameter settings determine the DN formats to be applied to new entries.
![]()
- Location parameter settings determine where in the directory new entries reside.
![]()
Parameters in the
dsgw.conffile are described in Appendix A "Parameters Defined in the .conf File."The
templateparameter is used to map the gateway's HTML templates for entry types to the Directory Server's LDAP object classes.The
locationparameter is used to define points in the directory tree where new entries can be added. Thelocationparameter definitions must precedenewtypeparameter definitions in the.conffile.Each entry type is described by a
newtypeparameter. The newtype template indicates how the entry will be formatted and the location in the directory tree where the entry will be created. Entry types for the default gateway appear in the pop-up menu gateway forms, for instance the Create New Entry form (Figure 4-1).Considerations for Adding New Entry Types
Before adding support for a new entry type (object class), decide:
- Where will the new entry be created?
![]()
- If a
locationparameter is not set up to point to the location where the new entry type will be created, add a newlocationparameter to thedsgw.conffile.
- How will the new entry will be formatted?
![]()
- When the new object class has many attributes in common with an existing entry type, update the corresponding template line in
dsgw.confto support the new object class. When a new object class requires a new template, add a newtemplateparameter todsgw.conf.
- The
newtypeandlocationparameters are described in Appendix A "Parameters Defined in the .conf File."
Mapping Locations and Entry Types
The
locationparameter is used to define points in the directory tree where new entries can be added. The default locations defined indsgw.confare intended for the sample directory shipped with the Directory Server. They are unlikely to match the structure of the actual directory.This section explains the following:
- Mapping Entry Types to Locations
![]()
- Configuring DN Formats for Entry Types
![]()
For simple directory structures, define locations that represent branch points in the directory. For complex structures, define branch points for the most commonly used directory branches only.
Mapping Entry Types to Locations
Each entry type must be mapped to a location where that type of entry can be placed. The following example shows a mapping of locations and newtype parameters in
dsgw.conf:
In the example, locations defined in the
newtypeparameter (such ascountry,org, orgroups) correspond to handles defined in thelocationparameter. The friendly names (in quotes) in the third column indicate the choices that will appear in pull-down menus on gateway forms.
Locationparameter definitions indsgw.confmust be listed beforenewtypeparameter definitions.
See Entry Types (Object Classes) for more information.
Setting Up Organizational Units
Assuming that the root DN is set to
o=example.com, the mappings in the following example can be used to create people in the following organizational units:ou=Accounting, o=example.com
ou=Human Resources, o=example.com
ou=Payroll, o=example.com
ou=Product Development, o=example.com
ou=Product Testing, o=example.comConfiguring DN Formats for Entry Types
The following sections describe how to configure entry type DNs depending upon the format.
When a person or NT person entry is added to the directory, the gateway prompts for a unique DN. The unique DN is typically the user ID of a person in the organization.
Although DN formats can be based on the common names of employees in the organization, common names are frequently not unique within an organization.
UID-based DN formats are recommended because they are by nature unique and can prevent naming collisions within the directory.
Modifying the Default DN Format
The default DN format can be modified by editing the
rdnattrvariable within thenewtypeparameter.To change the gateway configuration so that person entries are created using common name-based DNs rather than user ID-based DNs, edit the following line in the
dsgw.conffile:
newtype orgperson "Person" uid people special
newtype orgperson "Person" cn people specialObject Class Attributes in Template Files
The following sections describe the object classes and attributes contained by the template files:
- Default Gateway Object Classes
![]()
- Templates and Directives
![]()
- Adding Attributes to Object Classes
![]()
- Deleting Attributes from Object Classes
![]()
- Extending Object Classes
![]()
- Creating a New Parent Object Class
![]()
Default Gateway Object Classes
The default gateway supports the object classes listed in Table 4-1.
Table 4-1 Default Object Classes
Object class attributes associated with an entry type are defined by directives contained in gateway template files. Directives are instructions, written as HTML comments, that are interpreted by the gateway's CGI scripts. Each directive is an independent, single line of HTML in a template file (with the exception of
<!-- GCONTEXT -->, which is embedded within an URL).Entry-related directives are responsible for how the gateway displays, edits, adds, and lists directory entries. The most commonly used entry-related directive is
DS_ATTRIBUTE, which determines how attributes in LDAP entries are displayed on gateway forms.
DS_ATTRIBUTEdirectives begin with aDS_ENTRYBEGINtag and close with aDS_ENTRYENDtag.Appendix B "Gateway Directives" lists the possible arguments for the
DS_ATTRIBUTEdirective.Adding Attributes to Object Classes
Adding an attribute to an object class requires adding an additional row to the HTML table in the template file where the object class is defined.
The syntax in the following example defines an
Initialsattribute for theorgpersonobject class:<TR>
<TD VALIGN= "TOP" NOWRAP>Initials</TD><TD VALIGN= "TOP" NOWRAP><B>
<!-- DS ATTRIBUTE "attr=Initials" "syntax=cis" "cols=>16" -->
</B></TD>
<TD> </TD>
<TD> </TD>
</TR>To complete the row, two null cells are added. This maintains the HTML table format. For Asian character sets, substitute an ideographic space for the non-breaking space ( ) shown in the example.
Attribute values are added in pairs. When adding a single attribute to an object class, remember to complete the table row.
Deleting Attributes from Object Classes
Deleting an attribute from an object class requires deleting a complete row or part of a row from the HTML table where the object is defined. The following example shows the steps required to delete the mobile phone attribute from the
orgpersonobject class:
- Open
display-orgperson.htmltemplate and delete the mobile phone attribute-value pair (boldfaced text below).![]()
<TR>
<TD VALIGN="TOP" NOWRAP>Pager:</TD>
<TD VALIGN="TOP" NOWRAP><B>
<!-- DS ATTRIBUTE "attr=pager" "syntax=tel" "cols=>16" -->
</B></TD>
<TD VALIGN="TOP" NOWRAP>Mobile Phone:</TD>
<TD VALIGN="TOP" NOWRAP><B>
<!-- DS ATTRIBUTE "attr=mobile" "syntax=tel" "cols=>16" -->
</B></TD>
</TR>
- Insert a null pair to replace the deleted attribute (boldfaced below).
![]()
<TR>
<TD VALIGN="TOP" NOWRAP>Pager:</TD>
<TD VALIGN="TOP" NOWRAP><B>
<!-- DS ATTRIBUTE "attr=pager" "syntax=tel" "cols=>16" -->
</B></TD>
<TD> </TD>
<TD> </TD>
</TR>
The gateway can be extended to support additional object classes. This requires changing information in an existing object class template so that the gateway displays the associated entry type.
When extending object class definitions, the child should appear below the parent object class in the HTML file. Otherwise, the gateway cannot correctly interpret the HTML syntax.
Adding a Template for a Child of a Parent Class
The easiest way to create a new object class is to extend an existing object class template, adding and deleting attributes as necessary. The following example shows the steps required to add a template for a new object class,
examplePerson. The new template adds two custom attributes,dateOfBirthandpreferredOS, to theinetOrgPersonobject class.
- Copy the
display-orgperson.htmlfile and rename it asdisplay-exampleperson.html.![]()
- Edit the third line in the template file to indicate the name of the new directory entry type. Change:
![]()
<!-- inet. organizational person directory entry -->
- to
<!-- example person directory entry -->
- Edit the
DS_OBJECTCLASSdirective to include the new object class. Change:![]()
<!-- DS_OBJECTCLASS "value=person,inetOrgPerson" -->
- to
<!-- DS_OBJECTCLASS "value=person,inetOrgPerson, exampleperson" -->
- Add the value for
examplepersonto the input type.![]()
<!-- IF "Adding" -->
<INPUT TYPE="hidden" NAME="add_objectClass" VALUE="top">
<INPUT TYPE="hidden" NAME="add_objectClass" VALUE="person">
<INPUT TYPE="hidden" NAME="add_objectClass" VALUE="organizationalPerson">
<INPUT TYPE="hidden" NAME="add_objectClass" VALUE="inetOrgPerson">
<INPUT TYPE="hidden" NAME="add_objectClass" VALUE="exampleperson">
- Be sure to add the line immediately before the
ENDIFdirective:
<!-- ENDIF // Adding -->
- Add a new table row containing the
dateOfBirthandpreferredOSattribute-value pairs.![]()
<TR>
<TD VALIGN="TOP">Date of Birth:</TD>
<TD VALIGN="TOP"><B>
<!-- DS_ATTRIBUTE "attr=dateOfBirth" "cols=>8" -->
</B></TD>
<TD VALIGN="TOP">Preferred OS</TD>
<TD VALIGN="TOP"><B>
<!-- DS_ATTRIBUTE "attr=preferredOS" "cols=>6" -->
</B></TD></TR>
- For more information on adding attributes, see Object Class Attributes in Template Files.
- Define a
templateparameter indsgw.conffor the object classexamplePerson:![]()
template exampleperson person inetorgperson exampleperson
- This will instruct the gateway to display the
examplepersonentry type according to the template defined for theexamplePersonobject class (display-exampleperson.html).
- Update the Directory Server schema to include the
examplePersonobject class.![]()
- To allow users to add entries for
examplepersonusing the gateway, add an additionalnewtypeparameter to thedsgw.conffile. If this entry type is for display purposes only, nonewtypeparameter needs to be added.![]()
See Considerations for Adding New Entry Types, and Extending Search Preferences.
Creating a New Parent Object Class
These steps are required when the object class is not a child of an existing object class.
- Add a template parameter to
dsgw.conffor the new object class.![]()
templatenewobjectclass
- This will instruct the gateway to display the associated entry type according to the template defined for the new object class.
- To allow gateway users to add entries for the entry type, add an additional
newtypeparameter to thedsgw.conffile. If the associated entry type is for display purposes only, nonewtypeparameter needs to be added.![]()
- Update the Directory Server schema to include the new object class.
![]()
- Add a search object entry to
dsgwsearchprefs.confand updatedsgwfilter.confso that the gateway will search for entries of this type.![]()
- Create a new search results form defining how the gateway will display search results for the new object class.
![]()
Modify an existing search result form to create a new search results form. See Adding Information to Search Results and Removing Information From Search Results.
© 2001 Sun Microsystems, Inc. Portions copyright 1999, 2002-2003 Netscape Communications Corporation. All rights reserved.
Read the Full Copyright and Thrid-Party Acknowledgments.
Last Updated October 31, 2003