Cannot access portal due to NoSuchResourcePermissionException exception

Issue

  • An error when rendering a page produces a critical issue that blocks the portal access.
  • In the logs you could see a trace similar to this:
          com.liferay.portal.kernel.events.ActionException: java.lang.IllegalArgumentException:
          Someone may be trying to circumvent the permission checker: {companyId=20155,
          name=com.liferay.portal.kernel.model.Layout, primKey=361751, scope=4}
com.liferay.portal.kernel.events.ActionException:
          java.lang.IllegalArgumentException: Someone may be trying to circumvent
          the permission checker: {companyId=20155, name=com.liferay.portal.kernel.model.Layout,
          primKey=361751, scope=4}
 at com.liferay.portal.events.ServicePreAction.run(ServicePreAction.java:154)
          at com.liferay.portal.kernel.events.Action.processLifecycleEvent(Action.java:34)
          at com.liferay.portal.events.EventsProcessorUtil.process(EventsProcessorUtil.java:88)
          at com.liferay.portal.events.EventsProcessorUtil.process(EventsProcessorUtil.java:60)
          at com.liferay.portal.internal.servlet.MainServlet._processServicePre(MainServlet.java:1146)
          at com.liferay.portal.internal.servlet.MainServlet.service(MainServlet.java:580)
          ...
  • It is caused by:
    Caused by: java.lang.IllegalArgumentException: Someone may be trying to circumvent the permission checker: {companyId=20155, name=com.liferay.portal.kernel.model.Layout, primKey=361751, scope=4}  
        at com.liferay.portal.security.permission.AdvancedPermissionChecker._hasGuestPermission(AdvancedPermissionChecker.java:1463)  
        at com.liferay.portal.security.permission.AdvancedPermissionChecker._hasPermissionImpl(AdvancedPermissionChecker.java:1479)  
        at com.liferay.portal.security.permission.AdvancedPermissionChecker.hasPermission(AdvancedPermissionChecker.java:306)  
        at com.liferay.portal.security.permission.BasePermissionChecker.hasPermission(BasePermissionChecker.java:114)  
        at com.liferay.staging.security.internal.permission.StagingPermissionChecker.hasPermission(StagingPermissionChecker.java:135)  
        at com.liferay.portal.service.permission.LayoutPermissionImpl.containsWithoutViewableGroup(LayoutPermissionImpl.java:281)  
        at com.liferay.portal.service.permission.LayoutPermissionImpl.containsWithoutViewableGroup(LayoutPermissionImpl.java:329)  
        at com.liferay.portal.service.permission.LayoutPermissionImpl.containsWithViewableGroup(LayoutPermissionImpl.java:343)  
        at com.liferay.portal.service.permission.LayoutPermissionImpl._contains(LayoutPermissionImpl.java:605)  
        at com.liferay.portal.service.permission.LayoutPermissionImpl.contains(LayoutPermissionImpl.java:147)  
        at com.liferay.portal.kernel.service.permission.LayoutPermissionUtil.contains(LayoutPermissionUtil.java:64)  
        at com.liferay.portal.events.ServicePreAction._hasAccessPermission(ServicePreAction.java:747)  
        at com.liferay.portal.events.ServicePreAction._getViewableLayoutComposite(ServicePreAction.java:707)  
        at com.liferay.portal.events.ServicePreAction._getDefaultViewableLayoutComposite(ServicePreAction.java:570)  
        at com.liferay.portal.events.ServicePreAction._initThemeDisplay(ServicePreAction.java:1169)  
        at com.liferay.portal.events.ServicePreAction.servicePre(ServicePreAction.java:177)  
    		at com.liferay.portal.events.ServicePreAction.run(ServicePreAction.java:151)  ... 76 more
    Caused by: com.liferay.portal.kernel.exception.NoSuchResourcePermissionException:{companyId=20155, name=com.liferay.portal.kernel.model.Layout, primKey=361751,scope=4} at com.liferay.portal.service.impl.ResourcePermissionLocalServiceImpl.hasResourcePermission(ResourcePermissionLocalServiceImpl.java:1022)
        ...(removed lines)
        at com.liferay.portal.monitoring.internal.aop.ServiceMonitorAdvice.invoke(ServiceMonitorAdvice.java:79)
        ...(removed lines)
        at com.liferay.portal.kernel.service.ResourceLocalServiceUtil.hasUserPermissions(ResourceLocalServiceUtil.java:345)
        at com.liferay.portal.security.permission.AdvancedPermissionChecker._hasGuestPermission(AdvancedPermissionChecker.java:1454)

Environment

  • Liferay DXP 7.2

Resolution

  • The log reveals a problem related with the layout with id 361751.
  • What is happening?
    • When the portal renders a site page it also processes more site pages (in ServicePreAction._getDefaultViewableLayoutComposite(ServicePreAction.java:570)) and checks their permissions.
    • When one of these pages has an inconsistency related with these permissions, the process is broken, the page cannot be rendered and the site is blocked.
  • Since this is a critical issue, we suggest two action points that could help you with to avoid the issue:
    • Quick workaround: Once you've identified the "broken" layout you could modify its groupId id to avoid processing it when rendering a site. You could do this, for example, with an script. In any case, we only suggest this option in order to avoid the site block, and it is not the final solution.
    • Final solution: you could open a new ticket to Liferay Support and ask for a new hotfix (if needed) that includes the LPS-138565. This fix allows to continue processing the page when the error occurs, so the error does not block the portal.

Additional Information

 

¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0