Skip to content

Commit

Permalink
LPS-110168 Do not show ancestor pages that are inaccessible
Browse files Browse the repository at this point in the history
  • Loading branch information
dacousalr authored and brianchandotcom committed Apr 6, 2020
1 parent de047ab commit e180149
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,16 @@ public List<BreadcrumbEntry> getRelativeBreadcrumbEntries(Layout layout)
if (showLayoutPath) {
BreadcrumbEntry breadcrumbEntry = new BreadcrumbEntry();

breadcrumbEntry.setTitle(
curLayout.getName(themeDisplay.getLocale()));
if (LayoutPermissionUtil.contains(
themeDisplay.getPermissionChecker(), curLayout,
ActionKeys.VIEW)) {

breadcrumbEntry.setTitle(
curLayout.getName(themeDisplay.getLocale()));
}
else {
breadcrumbEntry.setTitle(StringPool.TRIPLE_PERIOD);
}

breadcrumbEntries.add(breadcrumbEntry);
}
Expand Down Expand Up @@ -1118,6 +1126,21 @@ public boolean isLayoutPageTemplateEntry() {
return false;
}

public boolean isLayoutReachable(Layout layout) throws PortalException {
List<Layout> layouts = layout.getAncestors();

for (Layout curLayout : layouts) {
if (!LayoutPermissionUtil.contains(
themeDisplay.getPermissionChecker(), curLayout,
ActionKeys.VIEW)) {

return false;
}
}

return true;
}

public boolean isPrivateLayout() {
if (_privateLayout != null) {
return _privateLayout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,13 @@ if (Validator.isNotNull(redirect)) {
>

<%
PortletURL portletURL = layoutsAdminDisplayContext.getPortletURL();
PortletURL portletURL = null;
portletURL.setParameter("selPlid", String.valueOf(layout.getPlid()));
if (layoutsAdminDisplayContext.isLayoutReachable(layout)) {
portletURL = layoutsAdminDisplayContext.getPortletURL();
portletURL.setParameter("selPlid", String.valueOf(layout.getPlid()));
}
%>

<liferay-ui:search-container-column-text
Expand Down

0 comments on commit e180149

Please sign in to comment.