Platform Explorer / Nuxeo Platform 10.1

Extension point computer

Extension point to contribute a new class to compute virtual groups.

The contribution should be as the following example :

    <groupComputer name="MyGroupComputerName">
        <computer>fullClassName</computer>
    </groupComputer>

The contributed class must implement the org.nuxeo.ecm.platform.computedgroups.GroupComputer interface.

To simplify the Computer group generation you can also contribute a simple group computer without java code contribution based on

  • user profile metadata (military grade given a abilitation level, for instance)
  • metadata given a list of documents (ex: local group)

For the first case, you just have to contribute:

    <userMetadataGroupComputer enabled="false" groupPattern="grade_%s"
        name="grade_cg" xpath="company"/>

Here for each user, during the connection time, Nuxeo affect the group grade_xxx where xxx the value of the company metadata stored into the user profile. If the company metadata is empty or contains only spaces No group is affected to the user.

For the second possibility (metadata given a list of documents), you just have to contribute:

    <documentMetadataGroupComputer groupPattern="creator_%s"
        name="creator_cg" whereClause="dc:creator = '%s'" xpath="dc:title"/>

Here, we select documents created by the user. For each document found, we affect the group creator_xxx where xxx is the title of the document. But you can also try this:

    <documentMetadataGroupComputer groupPattern="creator_%s"
        name="creator_cg" whereClause="dc:creator = '%s'" xpath="ecm:uuid"/>

Here, xxx is replaced by the id of the document. XPath value is based on NXQL query and fetch selector. See the NXQL documentation to have more information.

  • 5.3.1-SNAPSHOT

This is the main ExtensionPoint for the ComputedGroupsService.

It is used to register a class that will implement the logic for computing groups.

The contributed class has to implement org.nuxeo.ecm.platform.computedgroups.GroupComputer interface.

In order to make contribution easier, UserManager comes with 2 base classes for implementing the GroupComputer interface :

  • AbstractGroupComputer : include basic search feature
  • AbstractAttributeBasedGroupComputer : generate groups based on user’s attributes

Contribution Descriptor

Existing Contributions

Additional documentation

Code Sample  
computer
  • 5.3.1-SNAPSHOT

This is the main ExtensionPoint for the ComputedGroupsService.

It is used to register a class that will implement the logic for computing groups.

The contributed class has to implement org.nuxeo.ecm.platform.computedgroups.GroupComputer interface.

In order to make contribution easier, UserManager comes with 2 base classes for implementing the GroupComputer interface :

  • AbstractGroupComputer : include basic search feature
  • AbstractAttributeBasedGroupComputer : generate groups based on user’s attributes
Add a new group computer
  • 5.3.1-SNAPSHOT

Let’s take the example of the built-in CompanyGroupComputer. The idea is to create groups based on the company attribute of the users.

Here are the steps :

1 - Create the implementation class (see CompanyGroupComputer.class)

  • Inherit from AbstractAttributeBasedGroupComputer
  • Implement the getAttributeForGroupComputation method to define the attribute used

2 - Declare your new computer (see computer-registration-config.xml)

You use the computer ExtensionPoint to register you new computer

3 - Put your computer in the chain (see computer-chain-config.xml)

You use the computerChain ExtensionPoint to register you new computer in the chain.