尝试在liferay 7.3中更新网站的模板时,我不断收到权限错误



我在尝试更新站点(组)模板时遇到了一个问题。模板被分配并正确工作,但这样做时会抛出几个错误。它们都是一样的:

2023-01-18 10:42:24.934 ERROR [http-nio-8080-exec-48][FragmentRendererControllerImpl:120] Unable to render content of fragment entry 0:com.liferay.fragment.exception.FragmentEntryContentException: com.liferay.portal.kernel.portlet.PortletContainerException: java.lang.IllegalArgumentException: Someone may be trying to circumvent the permission checker: {company>
2023-01-18 10:42:24.936 ERROR [http-nio-8080-exec-48][FragmentRendererControllerImpl:120] Unable to render content of fragment entry 0:com.liferay.fragment.exception.FragmentEntryContentException: java.lang.NullPointerException

这不是一个错误,我理解。因为我没有检查许可,没有许可的人根本不会看到按钮,也无法按下它。我有代码在我的视图。jsp,但即使当我删除它的错误仍然存在。

这是我更新组的代码:

// I first update a custom field showing if the site is active or not
group.getExpandoBridge().setAttribute("Status", "Actief" );
LayoutSetLocalServiceUtil.updateLayoutSetPrototypeLinkEnabled(groupId, true, true, privateTemp);

就像我说的,我试图删除任何权限检查代码,但这没有效果。我使用的方法是从LayoutSetLocalServiceUtil类。鉴于它是本地的,这个方法也不应该检查权限。当我尝试运行我的代码时,我也以admin身份登录,所以我应该有权限这样做。

我还尝试使用:

隐藏错误
SessionMessages.add(portletRequest, PortalUtil.getPortletId(portletRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);

但由于某种原因,这实际上并没有隐藏它,也没有解决问题。有人以前遇到过这个吗?为什么我一直得到一个权限错误没有检查任何权限?

在执行更新ExpandoBridge属性的自定义代码期间,我遇到了类似的权限问题。尝试以下更新:

boolean isSecure = false; // Forces the use of ExpandoBridgeLocalService w/o permissions checking
// I first update a custom field showing if the site is active or not
group.getExpandoBridge().setAttribute("Status", "Actief", isSecure);
LayoutSetLocalServiceUtil.updateLayoutSetPrototypeLinkEnabled(groupId, true, true, privateTemp);

参考:https://docs.liferay.com/dxp/portal/7.4-latest/javadocs/portal-kernel/com/liferay/expando/kernel/model/ExpandoBridge.html setAttribute-java.lang.String-java.io.Serializable-boolean——

最新更新