<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "../../Reference_Guide.ent">
%BOOK_ENTITIES;
]>
<section id="sect-Reference_Guide-Predefined_User_Configuration">
	<title>Predefined User Configuration</title>
	<section id="sect-Reference_Guide-Predefined_User_Configuration-Overview">
		<title>Overview</title>
		<para>
			To specify the initial Organization configuration, the content of <emphasis>02portal.war:/WEB-INF/conf/organization/organization-configuration.xml </emphasis> should be edited. This file uses the portal XML configuration schema. It lists several configuration plugins.
		</para>
	</section>
	
	<section id="sect-Reference_Guide-Predefined_User_Configuration-Plugin_for_adding_users_groups_and_membership_types">
		<title>Plugin for adding users, groups and membership types</title>
		<para>
			The plugin of type <emphasis>org.exoplatform.services.organization.OrganizationDatabaseInitializer</emphasis> is used to specify the list of membership types/groups/users to be created.
		</para>
		<para>
			The <emphasis >checkDatabaseAlgorithm</emphasis> initialization parameter determines how the database update is performed.
		</para>
		<para>
			If its value is set to <emphasis >entry</emphasis>, it means that each user, group and membership listed in the configuration is checked each time &PRODUCT; is started.
         If the entry does not exist in the database yet, it is created. If the <emphasis >checkDatabaseAlgorithm</emphasis> parameter value is set to <emphasis >empty</emphasis>,
         the configuration data will be updated to the database only if the database is empty.
		</para>
	</section>
	
	<section id="sect-Reference_Guide-Predefined_User_Configuration-Membership_types">
		<title>Membership types</title>
		<para>
			The predefined membership types are specified in the <emphasis >membershipType</emphasis> field of the <emphasis >OrganizationConfig</emphasis> plugin parameter.
		</para>
      <note>
         <para>
            See <emphasis>02portal.war:/WEB-INF/conf/organization/organization-configuration.xml</emphasis> for the full content.
         </para>
      </note>
		
<programlisting language="xml">&#60;field name=&#34;membershipType&#34;&#62;
  &#60;collection type=&#34;java.util.ArrayList&#34;&#62;
    &#60;value&#62;
      &#60;object type=&#34;org.exoplatform.services.organization.OrganizationConfig$MembershipType&#34;&#62;
        &#60;field name=&#34;type&#34;&#62;
          &#60;string&#62;member&#60;/string&#62;
        &#60;/field&#62;
        &#60;field name=&#34;description&#34;&#62;
          &#60;string&#62;member membership type&#60;/string&#62;
        &#60;/field&#62;
      &#60;/object&#62;
    &#60;/value&#62;
    &#60;value&#62;
      &#60;object type=&#34;org.exoplatform.services.organization.OrganizationConfig$MembershipType&#34;&#62;
        &#60;field name=&#34;type&#34;&#62;
          &#60;string&#62;owner&#60;/string&#62;
        &#60;/field&#62;
        &#60;field name=&#34;description&#34;&#62;
          &#60;string&#62;owner membership type&#60;/string&#62;
        &#60;/field&#62;
      &#60;/object&#62;
     &#60;/value&#62;
     &#60;value&#62;
       &#60;object type=&#34;org.exoplatform.services.organization.OrganizationConfig$MembershipType&#34;&#62;
         &#60;field name=&#34;type&#34;&#62;
           &#60;string&#62;validator&#60;/string&#62;
         &#60;/field&#62;
         &#60;field name=&#34;description&#34;&#62;
           &#60;string&#62;validator membership type&#60;/string&#62;
         &#60;/field&#62;
       &#60;/object&#62;
     &#60;/value&#62;
   &#60;/collection&#62;
&#60;/field&#62;
</programlisting>
	</section>
	
	<section id="sect-Reference_Guide-Predefined_User_Configuration-Groups">
		<title>Groups</title>
		<para>
			The predefined groups are specified in the <emphasis >group</emphasis> field of the <emphasis >OrganizationConfig</emphasis> plugin parameter.
		</para>
		
<programlisting language="xml">&#60;field name=&#34;group&#34;&#62;
  &#60;collection type=&#34;java.util.ArrayList&#34;&#62;
    &#60;value&#62;
      &#60;object type=&#34;org.exoplatform.services.organization.OrganizationConfig$Group&#34;&#62;
        &#60;field name=&#34;name&#34;&#62;
          &#60;string&#62;portal&#60;/string&#62;
        &#60;/field&#62;
        &#60;field name=&#34;parentId&#34;&#62;
          &#60;string&#62;&#60;/string&#62;
        &#60;/field&#62;
        &#60;field name=&#34;type&#34;&#62;
          &#60;string&#62;hierachy&#60;/string&#62;
        &#60;/field&#62;
        &#60;field name=&#34;description&#34;&#62;
          &#60;string&#62;the /portal group&#60;/string&#62;
        &#60;/field&#62;
      &#60;/object&#62;
    &#60;/value&#62;
    &#60;value&#62;
      &#60;object type=&#34;org.exoplatform.services.organization.OrganizationConfig$Group&#34;&#62;
        &#60;field name=&#34;name&#34;&#62;
          &#60;string&#62;community&#60;/string&#62;
        &#60;/field&#62;
        &#60;field name=&#34;parentId&#34;&#62;
          &#60;string&#62;/portal&#60;/string&#62;
        &#60;/field&#62;
        &#60;field name=&#34;type&#34;&#62;
          &#60;string&#62;hierachy&#60;/string&#62;
        &#60;/field&#62;
        &#60;field name=&#34;description&#34;&#62;
          &#60;string&#62;the /portal/community group&#60;/string&#62;
        &#60;/field&#62;
      &#60;/object&#62;
    &#60;/value&#62;
    ...
  &#60;/collection&#62;
&#60;/field&#62;
</programlisting>
	</section>
	
	<section id="sect-Reference_Guide-Predefined_User_Configuration-Users">
		<title>Users</title>
		<para>
			The predefined users are specified in the <emphasis >membershipType</emphasis> field of the <emphasis >OrganizationConfig</emphasis> plugin parameter.
		</para>
		
<programlisting language="xml">&#60;field name=&#34;user&#34;&#62;
  &#60;collection type=&#34;java.util.ArrayList&#34;&#62;
    &#60;value&#62;
      &#60;object type=&#34;org.exoplatform.services.organization.OrganizationConfig$User&#34;&#62;
        &#60;field name=&#34;userName&#34;&#62;&#60;string&#62;root&#60;/string&#62;&#60;/field&#62;
        &#60;field name=&#34;password&#34;&#62;&#60;string&#62;exo&#60;/string&#62;&#60;/field&#62;
        &#60;field name=&#34;firstName&#34;&#62;&#60;string&#62;root&#60;/string&#62;&#60;/field&#62;
        &#60;field name=&#34;lastName&#34;&#62;&#60;string&#62;root&#60;/string&#62;&#60;/field&#62;
        &#60;field name=&#34;email&#34;&#62;&#60;string&#62;exoadmin@localhost&#60;/string&#62;&#60;/field&#62;
        &#60;field name=&#34;groups&#34;&#62;&#60;string&#62;member:/admin,member:/user,owner:/portal/admin&#60;/string&#62;&#60;/field&#62;
      &#60;/object&#62;
    &#60;/value&#62;
    &#60;value&#62;
      &#60;object type=&#34;org.exoplatform.services.organization.OrganizationConfig$User&#34;&#62;
        &#60;field name=&#34;userName&#34;&#62;&#60;string&#62;exo&#60;/string&#62;&#60;/field&#62;
        &#60;field name=&#34;password&#34;&#62;&#60;string&#62;exo&#60;/string&#62;&#60;/field&#62;
        &#60;field name=&#34;firstName&#34;&#62;&#60;string&#62;site&#60;/string&#62;&#60;/field&#62;
        &#60;field name=&#34;lastName&#34;&#62;&#60;string&#62;site&#60;/string&#62;&#60;/field&#62;
        &#60;field name=&#34;email&#34;&#62;&#60;string&#62;exo@localhost&#60;/string&#62;&#60;/field&#62;
        &#60;field name=&#34;groups&#34;&#62;&#60;string&#62;member:/user&#60;/string&#62;&#60;/field&#62;
      &#60;/object&#62;
    &#60;/value&#62;
    ...
  &#60;/collection&#62;
&#60;/field&#62;
</programlisting>
	</section>
	
	<section id="sect-Reference_Guide-Predefined_User_Configuration-Plugin_for_monitoring_user_creation">
		<title>Plugin for monitoring user creation</title>
		<para>
			The plugin of type <emphasis>org.exoplatform.services.organization.impl.NewUserEventListener </emphasis> specifies
         which groups all the newly created users should become members of. It specifies the groups and the memberships to use
         (while the group is just a set of users, a membership type represents a user's role within a group).
         It also specifies a list of users that should not be processed (i.e. administrative users like 'root').
		</para>
      <note>
         <para>The terms 'membership' and 'membership type' refer to the same thing, and are used interchangeably.</para>
      </note>
		
<programlisting language="xml">&#60;component-plugin&#62;
  &#60;name&#62;new.user.event.listener&#60;/name&#62;
  &#60;set-method&#62;addListenerPlugin&#60;/set-method&#62;
  &#60;type&#62;org.exoplatform.services.organization.impl.NewUserEventListener&#60;/type&#62;
  &#60;description&#62;this listener assign group and membership to a new created user&#60;/description&#62;
  &#60;init-params&#62;
    &#60;object-param&#62;
      &#60;name&#62;configuration&#60;/name&#62;
      &#60;description&#62;description&#60;/description&#62;
      &#60;object type=&#34;org.exoplatform.services.organization.impl.NewUserConfig&#34;&#62;
        &#60;field  name=&#34;group&#34;&#62;
          &#60;collection type=&#34;java.util.ArrayList&#34;&#62;
            &#60;value&#62;
              &#60;object type=&#34;org.exoplatform.services.organization.impl.NewUserConfig$JoinGroup&#34;&#62;
                &#60;field name=&#34;groupId&#34;&#62;&#60;string&#62;/user&#60;/string&#62;&#60;/field&#62;
                &#60;field name=&#34;membership&#34;&#62;&#60;string&#62;member&#60;/string&#62;&#60;/field&#62;
              &#60;/object&#62;
            &#60;/value&#62;               
          &#60;/collection&#62;
        &#60;/field&#62;
        &#60;field  name=&#34;ignoredUser&#34;&#62;
          &#60;collection type=&#34;java.util.HashSet&#34;&#62;
            &#60;value&#62;&#60;string&#62;exo&#60;/string&#62;&#60;/value&#62;
            &#60;value&#62;&#60;string&#62;root&#60;/string&#62;&#60;/value&#62;
            &#60;value&#62;&#60;string&#62;company&#60;/string&#62;&#60;/value&#62;
            &#60;value&#62;&#60;string&#62;community&#60;/string&#62;&#60;/value&#62;
          &#60;/collection&#62;
        &#60;/field&#62;
      &#60;/object&#62;
    &#60;/object-param&#62;
  &#60;/init-params&#62;
&#60;/component-plugin&#62;
</programlisting>
	</section>

</section>


