Hi,
I've now checked in multi-directory support in the trunk and the 5.1
branch. A multi-directory is an "indirecting" directory that sends
data to other underlying directories.
A multi-directory is made of several (ordered) sources, which are
consulted in turn. A source describes fully-formed directory entries.
As soon as a source contains the appropriate entry, it's the one
that's used.
Then in a source of entries you can build a given entry by picking
fields from several subdirectories. Furthermore, you can have field
renaming between the multi-directory schema fields and the
subdirectory fields when doing so.
Here's an example config:
<extension
target="org.nuxeo.ecm.directory.multi.MultiDirectoryFactory"
point="directories">
<directory name="users">
<schema>user</schema>
<idField>username</idField>
<passwordField>password</passwordField>
<source name="users" creation="true">
<subDirectory name="users_tech">
<field for="username">uid</field>
<field for="password">userPassword</field>
<field for="email">mail</field>
</subDirectory>
<subDirectory name="users_detail">
<field for="username">uid</field>
<field for="firstName">givenName</field>
<field for="lastName">sn</field>
<field for="company">o</field>
</subDirectory>
</source>
<source name="usersBis">
<subDirectory name="users_read_only">
<field for="username">uid</field>
<field for="password">password</field>
<field for="email">mail</field>
</subDirectory>
</source>
</directory>
</extension>
Here for the first source a few technical fields (uid, password,
mail) come from a first directory, and the rest of the users's
details come from another.
Each directory needs its schema of course.
When creating a new entry, it will be created in the source that's
marked creation="true".
All this can be used with new configuration in the userManager:
<extension target="org.nuxeo.ecm.platform.usermanager.UserService"
point="userManager">
<userManager>
<defaultAdministratorId>Administrator</defaultAdministratorId>
<defaultGroup>members</defaultGroup>
<userListingMode>search_only</userListingMode>
<users>
<directory>users</directory>
<emailField>email</emailField>
<searchFields>
<searchField>username</searchField>
<searchField>firstName</searchField>
<searchField>lastName</searchField>
</searchFields>
</users>
</userManager>
</extension>
You can now specify which directory holds the users, which field hold
the emails (this is currently still unused but it's good to have it),
and which fields are used for the "fulltext" search when calling
UserManager.searchPrincipals(String pattern).
Note that to be used as by the userManager, a directory must have a
password field specified (otherwise it will be considered "non-
authenticating").
If the <users> section is not present, then the backward-
compatibility default "userDirectory" is used.
Note that you can do the same for the groups directory (which
defaults to "groupDirectory" when absent):
<groups>
<directory>somegroupdir</directory>
<membersField>members</membersField>
<subGroupsField>subg</subGroupsField>
<parentGroupsField>parentg</parentGroupsField>
</groups>
Florent
--
Florent Guillaume, Director of R&D, Nuxeo
Open Source Enterprise Content Management (ECM)
http://www.nuxeo.com http://www.nuxeo.org +33 1 40 33 79 87
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm