Repository navigation
Check publish permission, upload size, scheduling and author email in AtomPub - #316
Merged
Merged
Conversation
… AtomPub AtomPub entry updates now require the POST permission when the entry would be published or scheduled, matching the XML-RPC handlers, so a Limited member can still edit a draft through AtomPub but can't publish it. Media uploads and replacements through AtomPub stop reading the body once it passes uploads.file.maxsize and answer 413, instead of writing the whole body to a temporary file before the size check. A future-dated entry posted or updated through AtomPub is marked SCHEDULED before tag counts are updated, so its tags appear in the weblog's tag counts once, when it goes live. JPAWeblogEntryManagerImpl also decides SCHEDULED before updating tag aggregates, and AtomPub updates that move an entry into or out of PUBLISHED refresh the entry's tag counts like the entry editor does. AtomPub entries and MetaWeblog post structs include the entry creator's email address only when the creator is the one asking; other weblog members see the user name.
snoopdave
reviewed
Nov 18, 2026
When a save moves an entry into or out of PUBLISHED, JPAWeblogEntryManagerImpl now works out the tag counts from the tags the entry had before the edit and the ones it has after it. Unpublishing or scheduling an entry while removing or changing tags no longer leaves the old tags counted, and publishing a draft while changing its tags counts only the new ones. AtomPub entries for scheduled posts are no longer marked as drafts, so reading a scheduled entry and sending it back unchanged keeps it scheduled. The Blogger and MetaWeblog editPost handlers now ask for a tag count refresh when an edit publishes, unpublishes or schedules an entry, including an edit that moves a published entry to a future date. AtomPub media uploads and replacements close the temporary file they read on every path, including when the upload is refused.
Contributor
Author
|
A second review raised a few more points, now addressed in the latest commits:
|
…b and XML-RPC edits An AtomPub PUT with no atom:published now keeps the publish time of an entry that is already published or scheduled, so a retitled scheduled entry no longer goes live early and a published entry is no longer re-dated. A draft PUT of an entry that is waiting for review leaves it waiting for review instead of turning it into a draft. The XML-RPC edit handlers now set SCHEDULED themselves when the publish time is more than a minute ahead, so the tag count decision and saveWeblogEntry() cannot disagree at the one-minute boundary. MetaWeblog getPost and getRecentPosts compare the entry's creator with the validated user's name rather than the login string, so the creator sees their own email whatever case they logged in with. The refreshAggregatesIfPublicationChanges helper moves above editPost's Javadoc, and EntryCollectionPermissionTest no longer turns on webservices.enableAtomPub in the shared test database, which EntryCollection does not read.
A draft PUT of an entry that is waiting for review sets it to DRAFT again, as it did before the previous commit and as it does in every release. Save as Draft in the entry editor and publish=false in the XML-RPC handlers do the same, so the three ways to edit an entry agree. Keeping such an entry in the review queue is not needed for the permission checks this branch adds.
snoopdave
reviewed
Nov 20, 2026
snoopdave
left a comment
Contributor
There was a problem hiding this comment.
Review of ee094c01d: The current code addresses the earlier review points, and the tests cover the changed publication and tag-count paths. The twin PR has the same fixes; its implementation differences follow the AtomPub and servlet API differences between branches. This was a source review only; no build was run.
Earlier comments: 4 of 4 resolved.
No new issues found.
snoopdave
approved these changes
Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four AtomPub (and some MetaWeblog and Blogger) changes:
POSTpermission, as the XML-RPC handlers already do, so a Limited member can still edit a draft through AtomPub but not publish it. A refused update answers 401, through the existingAtomNotAuthorizedException.uploads.file.maxsizeand answer 413, instead of writing the whole body to a temporary file before checking the size. The temporary file is closed on every path, including a refused upload.JPAWeblogEntryManagerImpldecides SCHEDULED before updating tag aggregates too, and when a save moves an entry into or out of PUBLISHED, it works out the counts from the tags the entry had before the edit and the ones it has after, so unpublishing or scheduling an entry while changing its tags doesn't leave the old tags counted, and publishing a draft with new tags counts only those. AtomPub updates and the Blogger and MetaWeblogeditPosthandlers refresh tag counts when an edit publishes, unpublishes or schedules an entry, as the entry editor does. AtomPub no longer marks scheduled entries as drafts, so reading one and sending it back unchanged keeps it scheduled.Tests:
EntryCollectionPermissionTest(new), plus cases inRollerAtomProtocolTest,MediaCollectionPathTestandXMLRPCWeblogPermissionTest, which also cover tag counts when an edit publishes, unpublishes or schedules an entry, a scheduled entry read and sent back through AtomPub, and the temporary file of a refused upload. Six of the original cases fail without the change.mvn testpasses.CHANGES entries for this and the related fixes will come in one PR.
A further review pass added these fixes:
atom:publishedkeeps the publish time of a published or scheduled entry, so a scheduled entry doesn't go live early and a published one isn't re-dated.