从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" });
}
谢谢你的建议。 –