<?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 <literal>02portal.war:/WEB-INF/conf/organization/organization-configuration.xml </literal> 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 <literal>org.exoplatform.services.organization.OrganizationDatabaseInitializer</literal> is used to specify a list of membership types, a list of groups, and a list of users to be created.
		</para>
		<para>
			The <emphasis role="bold">checkDatabaseAlgorithm</emphasis> initialization parameter determines how the database update is performed.
		</para>
		<para>
			If its value is set to <emphasis role="bold">entry</emphasis> it means that each user, group and membership listed in the configuration is checked each time &PRODUCT; is started.
         If the entry doesn&#39;t yet exist in the database, it is created. If <emphasis role="bold">checkDatabaseAlgorithm</emphasis> parameter value is set to <emphasis role="bold">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 role="bold">membershipType</emphasis> field of the <emphasis role="bold">OrganizationConfig</emphasis> plugin parameter.
		</para>
      <note>
         <para>
            See <literal>02portal.war:/WEB-INF/conf/organization/organization-configuration.xml</literal> for the full content.
         </para>
      </note>
		
<programlisting role="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 role="bold">group</emphasis> field of the <emphasis role="bold">OrganizationConfig</emphasis> plugin parameter.
		</para>
		
<programlisting role="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 role="bold">membershipType</emphasis> field of the <emphasis role="bold">OrganizationConfig</emphasis> plugin parameter.
		</para>
		
<programlisting role="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 <literal>org.exoplatform.services.organization.impl.NewUserEventListener </literal> specifies
         which groups all the newly created users should become members of. It specifies the groups and the memberships to use
         (while 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 role="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>


