snoopdave commented on code in PR #223:
URL: https://github.com/apache/roller/pull/223#discussion_r4394673131
##########
app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PreviewServlet.java:
##########
@@ -293,4 +301,21 @@ public void doGet(HttpServletRequest request,
HttpServletResponse response)
log.debug("Exiting");
}
+
+ /**
+ * Previews show unpublished content, so only an enabled user with a role
+ * in the weblog (or a global admin) may see them.
+ */
+ static boolean canPreview(Weblog weblog, User user) {
+ if (weblog == null || user == null ||
!Boolean.TRUE.equals(user.getEnabled())) {
+ return false;
+ }
+ try {
+ return
WebloggerFactory.getWeblogger().getUserManager().checkPermission(
Review Comment:
🤖Claude: fixed by adding globalAdminWithoutRoleCanPreview to
PreviewServletPermissionTest: a user with the global admin role and no weblog
permission can preview (a9a97c553).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]