Synchronizing users

Through WEBUI, we can configure initializers that register the default users.

Getting ready

Simply add in the XML file /WEB-INF/conf/organization/organization-configuration.xml, the users, roles, and membership types to pre-charge.

How to do it…

Use the following code to add, for example, the root user:

<object type=
"org.exoplatform.services.organization.OrganizationConfig$User">
    <field name="userName">
        <string>root</string></field>
    <field name="password">
        <string>gtn</string></field>
    <field name="firstName">
        <string>Root</string></field>
    <field  name="lastName">
        <string>Root</string></field>
    <field name="email">
        <string>root@localhost</string></field>
    <field  name="groups">
        <string>
manager:/platform/administrators,member:/platform/users,
                        member:/organization/management/executive-board
     </string>
   </field>
 </object>

The membership type for the root user:

<object type="org.exoplatform.services.organization.OrganizationConfig$MembershipType">
  <field  name="type">
      <string>manager</string></field>
  <field  name="description">
      <string>manager membership type</string></field>
</object>

And the group called administrators for the root user:

<object type="org.exoplatform.services.organization.OrganizationConfig$Group">
  <field  name="name">
    <string>administrators</string></field>
  <field  name="parentId">
    <string>/platform</string></field>
  <field  name="description">
    <string>the /platform/administrators group</string>
  </field>
  <field  name="label">
    <string>Administrators</string></field>
</object>

Note

Notice some details in this snippet are related to the tree structure of the group; the parentId field represents the name field of an other group to insert in the XML.

How it works…

GateIn provides one class to import users, membership types, and groups in the database:

org.exoplatform.services.organization.OrganizationDatabaseInitializer

Through this service, we can add permissions available for the portal. The identity objects will be inserted in the database at the first start of the portal.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.36.231