Affects Version/s: 7.0.0 DXP SP2, Master
If you have a large number of regular roles and/or site roles and try to access the permissions window for a portlet, the page can take an extremely long time to load. This happens because we grab every regular and site role from the database and then do some complicated logic to filter some of them out one by one. The logic takes a long time to run.
The fix will be to add a new finder method that includes the filtering logic in the query. This has the added advantage of only needing to fetch 20 roles from the database at a time (or however many roles are displayed on a page) since we now paginate the window as per
In my testing, I used a database with over 200000 roles, the vast majority of which were regular roles and site roles. I calculated that the permissions window would take 14 hours to load after waiting a while and using the debugger to see how many roles we had operated on. After I tested with my fix, the window loaded in around 15-30 seconds for each page.
Steps to Reproduce
1. Use a database with a large number of regular and site roles.
2. Start the portal.
3. Click on the ellipsis icon in the top-right corner of any portlet.
4. Select "Permissions".
Expected Result: The permissions window would load in a reasonable amount of time.
Actual Result: The permissions window takes way too long to load.
I have only tested this in a custom branch of 7.0 de-5 that had
LPS-68731 cherry-picked into it, but this should be reproducible in master and ee-7.0.x as well because we use the same problematic filtering logic in master and ee-7.0.x.