<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  This file is part of the Meeds project (https://meeds.io/).
  Copyright (C) 2022 Meeds Association
  contact@meeds.io
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 3 of the License, or (at your option) any later version.
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
  You should have received a copy of the GNU Lesser General Public License
  along with this program; if not, write to the Free Software Foundation,
  Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-->
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd http://www.exoplatform.org/xml/ns/kernel_1_2.xsd"
               xmlns="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd">
  <external-component-plugins>
    <target-component>org.exoplatform.portal.config.UserPortalConfigService</target-component>
    <component-plugin>
      <name>new.portal.config.user.listener</name>
      <set-method>initListener</set-method>
      <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
      <description>this listener init the portal configuration</description>
      <init-params>
        <object-param>
          <name>portal.configuration</name>
          <description>description</description>
          <object type="org.exoplatform.portal.config.NewPortalConfig">
            <field name="predefinedOwner">
              <collection type="java.util.HashSet">
                <value>
                  <string>global</string>
                </value>
              </collection>
            </field>
            <field name="ownerType">
              <string>portal</string>
            </field>
            <field name="templateLocation">
              <string>war:/conf/task-addon/</string>
            </field>
            <field name="override">
              <boolean>${exo.tasks.portalConfig.metadata.override:true}</boolean>
            </field>
            <field name="importMode">
              <string>${exo.tasks.portalConfig.metadata.importMode:merge}</string>
            </field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>
  <external-component-plugins>
    <target-component>org.exoplatform.application.registry.ApplicationRegistryService</target-component>
    <component-plugin>
      <name>spaces.portlets.registry</name>
      <set-method>initListener</set-method>
      <type>org.exoplatform.application.registry.ApplicationCategoriesPlugins</type>
      <description>this listener init the portlets are registered in PortletRegister</description>
      <init-params>
        <value-param>
          <name>merge</name>
          <value>true</value>
        </value-param>
        <object-param>
          <name>spacesApplications</name>
          <description>description</description>
          <object type="org.exoplatform.application.registry.ApplicationCategory">
            <field name="name">
              <string>spacesApplications</string>
            </field>
            <field name="displayName">
              <string>Spaces applications</string>
            </field>
            <field name="description">
              <string>Applications allowed to be added in spaces</string>
            </field>
            <field name="accessPermissions">
              <collection type="java.util.ArrayList" item-type="java.lang.String">
                <value>
                  <string>*:/platform/users</string>
                </value>
              </collection>
            </field>
            <field name="applications">
              <collection type="java.util.ArrayList">
                <value>
                  <object type="org.exoplatform.application.registry.Application">
                    <field name="applicationName">
                      <string>TasksManagement</string>
                    </field>
                    <field name="categoryName">
                      <string>spacesApplications</string>
                    </field>
                    <field name="displayName">
                      <string>Tasks</string>
                    </field>
                    <field name="description">
                      <string>Task Management Portlet</string>
                    </field>
                    <field name="type">
                      <string>portlet</string>
                    </field>
                    <field name="contentId">
                      <string>task-management/TasksManagement</string>
                    </field>
                    <field name="accessPermissions">
                      <collection type="java.util.ArrayList">
                        <value>
                          <string>Everyone</string>
                        </value>
                      </collection>
                    </field>
                  </object>
                </value>
              </collection>
            </field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
    <component-plugin>
      <name>tools.portlets.registry</name>
      <set-method>initListener</set-method>
      <type>org.exoplatform.application.registry.ApplicationCategoriesPlugins</type>
      <description>Add tasks portlet to Tools category</description>
      <init-params>
        <value-param>
          <name>system</name>
          <value>true</value>
        </value-param>
        <object-param>
          <name>tools</name>
          <description>Tools</description>
          <object type="org.exoplatform.application.registry.ApplicationCategory">
            <field name="name">
              <string>Tools</string>
            </field>
            <field name="displayName">
              <string>Tools</string>
            </field>
            <field name="accessPermissions">
              <collection type="java.util.ArrayList" item-type="java.lang.String">
                <value>
                  <string>*:/platform/users</string>
                </value>
              </collection>
            </field>
            <field name="applications">
              <collection type="java.util.ArrayList">
                <value>
                  <object type="org.exoplatform.application.registry.Application">
                    <field name="applicationName">
                      <string>tasks</string>
                    </field>
                    <field name="categoryName">
                      <string>tools</string>
                    </field>
                    <field name="displayName">
                      <string>My Tasks</string>
                    </field>
                    <field name="description">
                      <string>Task application</string>
                    </field>
                    <field name="type">
                      <string>portlet</string>
                    </field>
                    <field name="contentId">
                      <string>task-management/tasks</string>
                    </field>
                    <field name="accessPermissions">
                      <collection type="java.util.ArrayList" item-type="java.lang.String">
                        <value>
                          <string>*:/platform/users</string>
                        </value>
                      </collection>
                    </field>
                  </object>
                </value>
              </collection>
            </field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins>
    <target-component>org.exoplatform.portal.config.UserACL</target-component>
    <component-plugin>
      <name>tasks_projects_permissions</name>
      <set-method>addGroupVisibilityPlugin</set-method>
      <type>org.exoplatform.task.integration.ProjectGroupVisibilityPlugin</type>
    </component-plugin>
  </external-component-plugins>
</configuration>
