6.4. Using Views
6.4.1. About Views
nsview) and a filter attribute (
nsviewfilter) that set up a filter for the entries which belong in that view. Once the view container entry is added, all of the entries that match the view filter instantly populate the view. The target entries only appear to exist in the view; their true location never changes. For example, a view may be created as
ou=Location Views, and a filter is set for
l=Mountain View. Every entry, such as
cn=Jane Smith,l=Mountain View,ou=People,dc=example,dc=com, is immediately listed under the
ou=Location Viewsentry, but the real
cn=Jane Smithentry remains in the
Figure 6.4. A Directory Tree with a Virtual DIT View hierarchy
Example-views.ldif, installed with Directory Server. This file is in the
/usr/share/dirsrv/datadirectory on Red Hat Enterprise Linux 6 (64-bit).
6.4.2. Creating Views in the Console
- Select the Directory tab.
- In the left navigation tree, create an organizational unit suffix to hold the views. For instance, for views based on the locality (
l) attribute, name this organizational unit
Location Views. Creating sub suffixes is described in Section 188.8.131.52, “Creating a New Sub Suffix Using the Console”.
ou=Location Views, and select New > Other.
nsviewfrom the New Object menu, and click .
- In the Property Editor window, click the button, and add the organization unit object class.
- Name the organization unit according to how to organize the views. For instance,
ou=Sunnyvale. Make the
ouattribute the naming attribute.
- Click thebutton, and add the
- Create a filter that reflects the views, such as
- Click thebutton in the lower right corner to change the naming attribute.Use the
ouof the entry as the naming attribute instead of
- Clickto close the attributes box, and click again to save the new view entry.
6.4.3. Creating Views from the Command Line
- Use the
ldapmodifyutility to bind to the server and prepare it to add the new view entry to the configuration file.
-a-D "cn=directory manager" -W -p 389 -h server.example.com -x
- Add the new views container entry, in this example, under the
dc=example,dc=comroot suffix. This entry must have the
nsviewobject class and the
nsViewFilterattribute sets the attribute-value which identifies entries that belong in the view.
dn: ou=Example View,dc=example,dc=com changetype: add objectClass: top objectClass: organizationalUnit objectClass: nsview ou: Example View nsViewFilter: l=Mountain View description: Example View
6.4.4. Improving Views Performance
nsViewFilterattribute; the rest of the filter is based on the entry hierarchy, looking for the
parentidof the real entries included in the view.
parentid, or the attribute set in
nsViewFilter— are not indexed, then the views search becomes an unindexed search because the views operation searches the entire tree for matching entries.
parentid, and the attribute set in