7.1. Initializing organization by XML configuration

The OrganizationService component is used to manage entities in eXo Platform. It is responsible for creating/retrieving/updating/deleting them.

PicketLink

The default implementation of the OrganizationService component is the PicketLink. This implementation uses the PicketLink OpenSource project. PicketLink allows aggregating entities from multiple repositories (LDAPs, databases) by configuration. For example, it supports the following topologies:

Refer to PicketLink IDM integration for more details about PicketLink.

LDAP

The default configuration of PicketLink in eXo Platform manages everything in a database. eXo Platform comes with some examples to manage the Organization entities in a LDAP. You can find these examples in portal.war/WEB-INF/conf/organization/picketlink-idm/examples. Refer to LDAP integration using PicketLink for more details about LDAP.

Initializing entities for Organization Service via the XML configuration

To specify the initial Organization configuration, you first need to declare the org.exoplatform.services.organization.OrganizationDatabaseInitializer plugin in the configuration of your custom-extension.war. This plugin is used to specify a list of membership types, groups and users to be created.

The following snippet allows creating a membership, a group and a user via the org.exoplatform.services.organization.OrganizationDatabaseInitializer plugin.


<external-component-plugins>
    <target-component>org.exoplatform.services.organization.OrganizationService</target-component>
    <component-plugin>
        <name>init.service.listener</name>
        <set-method>addListenerPlugin</set-method>
        <type>org.exoplatform.services.organization.OrganizationDatabaseInitializer</type>
        <description>this listener populate organization data for the first launch</description>
        <init-params>
            <value-param>
                <name>checkDatabaseAlgorithm</name>
                <description>check database</description>
                <value>entry</value>
            </value-param>
            <value-param>
                <name>printInformation</name>
                <description>Print information init database</description>
                <value>false</value>
            </value-param>
            <object-param>
                <name>configuration</name>
                <description>description</description>
                <object
                        type="org.exoplatform.services.organization.OrganizationConfig">
                    <field name="membershipType">
                        <collection type="java.util.ArrayList">
                            ...
                            <!-- Custom membership -->
                            <value>
                                <object
                                        type="org.exoplatform.services.organization.OrganizationConfig$MembershipType">
                                    <field name="type">
                                        <string>custom-membership</string>
                                    </field>
                                    <field name="description">
                                        <string>the custom membership type</string>
                                    </field>
                                </object>
                            </value>
                            ...
                        </collection>
                    </field>
                    <field name="group">
                        <collection type="java.util.ArrayList">
                            ...
                            <!-- Custom group -->
                            <value>
                                <object
                                        type="org.exoplatform.services.organization.OrganizationConfig$Group">
                                    <field name="name">
                                        <string>custom</string>
                                    </field>
                                    <field name="parentId">
                                        <string>/platform</string>
                                    </field>
                                    <field name="description">
                                        <string>the /platform/custom group</string>
                                    </field>
                                    <field name="label">
                                        <string>Custom</string>
                                    </field>
                                </object>
                            </value>
                            ...

                        </collection>
                    </field>
                    <field name="user">
                        <collection type="java.util.ArrayList">
                            ...
                            <value>
                                <object
                                        type="org.exoplatform.services.organization.OrganizationConfig$User">
                                    <field name="userName">
                                        <string>custom</string>
                                    </field>
                                    <field name="password">
                                        <string>gtn</string>
                                    </field>
                                    <field name="firstName">
                                        <string>Custom-firstName</string>
                                    </field>
                                    <field name="lastName">
                                        <string>Custom-lastName</string>
                                    </field>
                                    <field name="email">
                                        <string>custom@localhost.com</string>
                                    </field>
                                    <field name="groups">
                                        <string>
                                            custom-membership:/organization/custom,
                                            member:/platform/users
                                        </string>
                                    </field>
                                </object>
                            </value>
                            ...
                        </collection>
                    </field>
                </object>
            </object-param>
        </init-params>
    </component-plugin>
</external-component-plugins>

Note

  • eXo Platform must predefine memberships, groups and a super user to make it work properly. You can find them in platform-extension.war!/WEB-INF/conf/organization/organization-configuration.xml.

  • You need to pay attention to the object type to know which attributes can be declared in the field tags.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus