Class PlannedAccess
Planned originals and thumbnails require an administrator with write access to the corresponding public folder. Preview helpers resolve multigroup copies to their master page; authorization to view page history remains the caller's responsibility.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanenabled()Reads whether private planned publishing is enabled for this installation.static voidhistoryPreview(DocDetails history, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Marks an authorized history view as a preview and selects its planned media when available.static booleanisPathAccessible(String path, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Checks whether the current user may read a planned original or thumbnail.static booleanisPlannedPreview(jakarta.servlet.http.HttpServletRequest request, int docId) Checks whether this request has selected planned media for the given page.static intmasterId(int docId) Resolves a multigroup copy to the master page that owns its planned media.
-
Field Details
-
PREVIEW_DOC
- See Also:
-
-
Method Details
-
enabled
public static boolean enabled()Reads whether private planned publishing is enabled for this installation.- Returns:
- current value of the
plannedPublishingEnabledconfiguration option
-
masterId
public static int masterId(int docId) Resolves a multigroup copy to the master page that owns its planned media.- Parameters:
docId- page ID to resolve- Returns:
- positive master page ID when mapped, otherwise the supplied page ID
-
isPathAccessible
public static boolean isPathAccessible(String path, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Checks whether the current user may read a planned original or thumbnail.Ordinary paths pass through without changing the response. For a planned path, caching is disabled and access requires an administrator with write permission for the corresponding public folder. Thumbnail paths beginning with
/thumb/use the same folder check as the original file.Denied or malformed planned paths receive status
404without a response body. Call this before checking file existence, handling conditional requests or reading cached thumbnails, and stop processing when it returnsfalse. This check applies even when planned publishing is disabled.- Parameters:
path- requested path or URL; null is treated as an ordinary pathrequest- request used to obtain the current userresponse- response receiving cache headers and, when denied, status404- Returns:
truefor an ordinary path or an authorized planned path
-
historyPreview
public static void historyPreview(DocDetails history, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Marks an authorized history view as a preview and selects its planned media when available.Disables response caching and sets the
isPreviewrequest attribute. If the history is scheduled for publication and its master page has initialized planned media, stores that master ID inPREVIEW_DOC. Viewing an older or unscheduled revision does not select the planned media set.- Parameters:
history- loaded history revision whose access has already been checkedrequest- request receiving the preview attributesresponse- response whose caching should be disabled
-
isPlannedPreview
public static boolean isPlannedPreview(jakarta.servlet.http.HttpServletRequest request, int docId) Checks whether this request has selected planned media for the given page.Multigroup copies match the same master ID, so a preview can use the master's planned media without selecting that media for unrelated pages.
- Parameters:
request- request carrying thePREVIEW_DOCattributedocId- page ID whose media are being requested- Returns:
trueif the selected preview ID matches this page's master ID
-