從5.0遷移(如果之前已設置訪客用戶的所有權限),似乎尚未設置文章的訪客查看權限。簡單解決方法是爲所有想要在相應社區中顯示給客人的文章分配訪客查看權限。這條線在下面的代碼分配查看權限
JournalArticleLocalServiceUtil.addArticleResources(groupId,
article.getArticleId(), new String[] { "VIEW" },
new String[] { "VIEW" });
其被稱爲資源,你將被添加權限文章資源。
ThemeDisplay themeDisplay = (ThemeDisplay) request
.getAttribute(WebKeys.THEME_DISPLAY);
long groupId = themeDisplay.getLayout().getGroupId();
List<JournalArticle> articles = JournalArticleLocalServiceUtil
.getArticles(groupId);
for (JournalArticle article : articles) {
JournalArticleLocalServiceUtil.addArticleResources(groupId,
article.getArticleId(), new String[] { "VIEW" },
new String[] { "VIEW" });
}
謝謝你的建議。 –