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

layoutTypePortlet.removePortletId is not working in PostLoginHook

    Details

    • Type: Bug
    • Status: Verified
    • Resolution: Unresolved
    • Affects Version/s: 6.2.5 CE GA6
    • Fix Version/s: None
    • Labels:
      None
    • Fix Priority:
      3
    • OS:
      Ubuntu LTS 14.04
    • JDK:
      Oracle Sun JDK 7
    • Application Servers:
      GlassFish 4.0
    • Databases:
      MySQL 5.7

      Description

      In a postLogin Hook, trying to remove all opened portlets using the following code:

       user = UserLocalServiceUtil.getUserById(userId);
                       long privatePlid = user.getGroup().getDefaultPrivatePlid();
                       Layout layout = LayoutLocalServiceUtil.getLayout(privatePlid);
                       LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) layout
                               .getLayoutType();
                       List<String> portletIds = layoutTypePortlet.getPortletIds();
                       for (String portletId : portletIds) {
                           layoutTypePortlet.removePortletId(userId, portletId);
                       }
                      LayoutLocalServiceUtil.updateLayout(layout.getGroupId(),
                              layout.isPrivateLayout(), layout.getLayoutId(),
                              layout.getTypeSettings());
      
      

      However no portlet removed, and the layout still the same.

      Liferay 6.2 deployed on glassfish 4, and java version 1.7.0_79

        Attachments

          Activity

            People

            • Assignee:
              support-lep@liferay.com SE Support
              Reporter:
              jdoe John Doe
              Participants of an Issue:
              Recent user:
              Esther Sanz
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since last comment:
                4 years, 14 weeks, 6 days ago

                Packages

                Version Package