Skip to content

Require a role in the weblog for page and resource previews - #223

Merged
snoopdave merged 5 commits into
roller-6.1.xfrom
preview-weblog-role
Oct 30, 2026
Merged

snoopdave merged 5 commits into
roller-6.1.xfrom
preview-weblog-role

Conversation

@snoopdave

Copy link
Copy Markdown
Contributor

Previews show unpublished content, so PreviewServlet and PreviewResourceServlet now return 404 unless the user is enabled and has a role in the weblog being previewed (any of Limited, Author or Admin). Global admins can still preview any weblog.

Tests: PreviewServletPermissionTest (new) and two new cases in PreviewResourceServletTest. Full build and tests pass on JDK 11.

@snoopdave snoopdave left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 GLM: PR-Review — 1 inline comment posted.

@snoopdave

Copy link
Copy Markdown
Contributor Author

🤖 GLM: PR-Review — General Issues

The following issues were found but cannot be attached to a specific line in the diff:

  • Important: CHANGES.md has no entry for this change. Other PRs in the 6.1.7 batch each carry one. Worth a note: page and resource previews now require an enabled user with a role in the weblog being previewed (or a global admin) — previously any signed-in editor/admin could preview any weblog.

Strengths (not action items): returning 404 rather than 403 avoids telling an unauthorized caller the weblog exists, and the servlet-level placement covers both the page and resource preview paths with tests at each.

@snoopdave

Copy link
Copy Markdown
Contributor Author

🤖Claude: fixed by adding a CHANGES.md entry under 6.1.7 behaviour changes (a9a97c5).

@mraible mraible left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified this narrows preview access to members of the weblog and excludes pending invitations. The focused tests pass. LGTM.

@snoopdave snoopdave left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check is in the right place in both servlets. Some improvements inline.

PreviewAccess.canPreview uses Weblog.hasUserPermission and logs a refusal
at debug level. Both preview servlets call it. A doGet test covers the
page preview servlet, and PreviewAccessTest adds a pending-invite case.
@snoopdave
snoopdave merged commit dfb0af6 into roller-6.1.x Oct 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants