Site Roles Are Incorrectly Assigned or Lost When They Are Selected from Different Pages

This article documents a bug in the search container with any list of selectable items. It was discovered that site administrators could not assign a Site Role if that Site Role is not listed on the first page. Roles that were listed on the second pages were subsequently deselected when more site roles were assigned to a user. This bug is found in all Liferay platforms.

The root cause for this error is because while implementing pagination improves performance by having requests and processes query in parts of the whole data set, there is a downside on the client side. Using the same example of Site Roles, on the client side, the information on subsequent pages 2, 3, or 4, is simply not available yet. Information is thus requested and then displayed only when the user navigates to those pages.

Unfortunately, at this time, there is no easy fix without changing how Liferay DXP implements pagination or risk major performance issues.

Steps to Reproduce:

  1. Navigate to the Control Panel → Users → Roles.
  2. Click the Site Roles tab.
  3. Create 20 or more Roles. (For simplicity, name them Site Role 1, 2, 3, etc.) In addition to the existing default Site Roles, the number should exceed 20 Entries and thus create a second page.
  4. Click the right arrow to advance to the next page to verify that all of them display.

Now, assign a Site Role to a member other than Test Test.

  1. Navigate to a site. (For testing purposes, I have created a site called Home Site Mockup where I have several dummy users already as site members.)
  2. Navigate to the Control Panel → Members → Site Membership.
  3. Select any user (e.g. Test Two) then click 3-dot icon → Assign Site Roles.
  4. Assign 4 roles: one from first page and 3 from the second page. For example, Site Role 4 and, Site Role 6, Site Role 7, Site Role 8.

    Figure 2. Select Site Role 1 on page 1.


    Figure 3. Select Site Roles 6, 7, and 8 on page 2.

  5. Click the Done button.
  6. At this point, the user Test Two has been assigned to four roles.

The expectation at this point is that if more Site Roles are assigned to the same user, all Site Roles will be listed in the Site Roles and Teams column on the right. However, this is where the bug is most evident. The next few steps illustrates this:

  1. Assign a fifth Site Role to Test Two. Click 3-dot icon → Assign Site Roles.
  2. Click the check box next to Site Role 5 then click the Done button.

See the image below:

Notice that the other Site Roles assigned are not listed and in fact have become deselected if checking the Assign Site Roles window again.


Workarounds Available

As noted above, there is no easy fix yet. However, Liferay Engineering is very much aware of the bug and is working on a permanent fix that will be available in a service pack or fix pack in the near future. That said, there are several short term solutions and workarounds.

Workaround #1
The first workaround is to change the pagination on the Assign Site Roles window from 20 to 30 entries. The three sites (Site Roles 6, 7, and 8) which used to be listed on the second page are now all one one page. Selecting them again then clicking Done successfully assigns all five Site Roles to the user Test Two.

One limitation of this workaround is that it works only for that particular window at that particular time. If the window is closed and reopened, the values go back to the default 20 entries per page. To make this change more permanent, in the, enter the following: This increases the number of displayed entries to 50. The maximum is 200.

Workaround #2
This is more of a best practices solution than a configuration issue. Ideally and truly depending on each customer's specific business needs, consider just how many Site Roles are needed and whether the permissions granted need to be so granular. Although Liferay DXP and Portal allow up to 200 entries to be displayed per page, in reality, sometimes fewer is better.

Was this article helpful?
0 out of 0 found this helpful