Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-63922

User-specific portlet preferences are not cleaned up when the portlet is removed and portlet can not be re-added

    Details

      Description

      Description:
      The customer wants to have his portlet to be user-, portlet- and layout-specific.

      Reproduction Steps:

      1. Note the followings:
        1. liferay-portlet-app_7_0_0.dtd/liferay-portlet-app_6_2_0.dtd
          <!--
          Set the preferences-company-wide value to true if the preferences for the
          portlet are across the entire company. Setting this value to true means
          the value for preferences-unique-per-layout and preferences-owned-by-group are
          not used. The default value is false.
          
          For example, an administrator could set the preferences to an Announcements
          portlet that would save a message in the portlet's preferences. This message
          would then be used across all pages for that company. The portlet must not be
          instanceable because instanceable portlets have uniquely generated portlet ids.
          
          The default behavior of the bundled Announcements portlet sets the instanceable
          value to true so that normal users cannot create company wide messages. A future
          release would include permissions for the edit mode versus the view mode which
          would allow an administrator to set the message while users would just view the
          message.
          -->
          <!ELEMENT preferences-company-wide (#PCDATA)>
          
          <!--
          Set the preferences-unique-per-layout value to true if the preferences for the
          portlet are unique across all pages. If set to false, the preferences for the
          portlet are shared across all pages. The default value is true.
          
          The preferences-unique-per-layout element is used in combination with the
          preferences-owned-by-group element. See the comments for the
          preferences-owned-by-group element for more information.
          -->
          <!ELEMENT preferences-unique-per-layout (#PCDATA)>
          
          <!--
          Set the preferences-owned-by-group value to true if the preferences for the
          portlet are owned by the group when the portlet is shown in a group page. If
          set to false, the preferences are owned by the user at all times. The default
          value is true.
          
          Suppose the Stocks portlet has preferences-unique-per-layout set to true and
          preferences-owned-by-group set to false. Users can set a different list of
          stocks for every personal page. Users can set a different list of stocks for
          every community page.
          
          Suppose the Stocks portlet has preferences-unique-per-layout set to false and
          preferences-owned-by-group set to false. Users can set one list of stocks to be
          shared across all personal pages. Users can set one list of stocks to be shared
          across a community's set of pages.
          
          Suppose the Stocks portlet has preferences-unique-per-layout set to true and
          preferences-owned-by-group set to true. Users can set a different list of stocks
          for every personal page. Administrators set the portlet preferences for users in
          a community page. Administrators can set a different list of stocks for every
          community page that are then shared by all users within a community.
          
          Suppose the Stocks portlet has preferences-unique-per-layout set to false and
          preferences-owned-by-group set to true. Users can set one list of stocks to be
          shared across all personal pages. Administrators set the portlet preferences for
          users in a community page. Administrators can set one list of stocks to be
          shared by all users across a community's set of pages.
          -->
          <!ELEMENT preferences-owned-by-group (#PCDATA)>
          
        2. For example, the Currency Converter portlet (com.liferay.currency.converter.web.portlet.CurrencyConverterPortlet is having this "com.liferay.portlet.preferences-owned-by-group=false", line in its @Component annotation for the "property" attribute, so its effective preferences setup is
          preferences-company-wide=false
          preferences-unique-per-layout=true
          preferences-owned-by-group=false
          
      2. Start a clean Liferay server and log on as the default administrator
      3. Add Currency Converter portlet to the default welcome page. Notice that this action will create a line in the PortletPreferences table with ownerType=3 (SCOPE_GROUP_TEMPLATE) something like
        '0', '21029', '20202', '0', '3', '20235', 'com_liferay_currency_converter_web_portlet_CurrencyConverterPortlet', '<portlet-preferences />'
        
      4. Click on the portlet's cog icon and click on Preferences. Make any changes and save
        Notice that this action will create a new line in the PortletPreferences table with the provided text as the user's preference, ownerType=4 (INDIVIDUAL) something like
        '0', '21030', '20202', '20250', '4', '20235', 'com_liferay_currency_converter_web_portlet_CurrencyConverterPortlet', '<portlet-preferences><preference><name>symbols</name><value>GBP</value><value>CNY</value><value>EUR</value><value>JPY</value></preference></portlet-preferences>'
        
      5. Remove the portlet from the page as the same user and try to add the portlet to the page again

      Actual Results:
      Only the PortletPreferences line with ownerType=3 is removed. The PortletPreferences line with ownerType=4 is still in the database.
      The portlet can not be added back to the page again

      Expected Results:
      The database entries should be removed properly and the portlet should be available in the portal so we can re-add it

      Reproduced on 6.2.x
      Reproduced on Master (9130f0881cb1a7697ae0091f0cdf203f2d0ae68b)

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  3 years, 28 weeks, 2 days ago

                  Packages

                  Version Package
                  6.2.X EE
                  7.0.1 CE GA2