Class PlannedAccess

java.lang.Object
sk.iway.iwcm.doc.PlannedAccess

public final class PlannedAccess extends Object
Checks access to planned files and tracks which page's planned media a preview should use.

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
    Modifier and Type
    Field
    Description
    static final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Reads whether private planned publishing is enabled for this installation.
    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.
    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.
    static boolean
    isPlannedPreview(jakarta.servlet.http.HttpServletRequest request, int docId)
    Checks whether this request has selected planned media for the given page.
    static int
    masterId(int docId)
    Resolves a multigroup copy to the master page that owns its planned media.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • enabled

      public static boolean enabled()
      Reads whether private planned publishing is enabled for this installation.
      Returns:
      current value of the plannedPublishingEnabled configuration 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 404 without a response body. Call this before checking file existence, handling conditional requests or reading cached thumbnails, and stop processing when it returns false. This check applies even when planned publishing is disabled.

      Parameters:
      path - requested path or URL; null is treated as an ordinary path
      request - request used to obtain the current user
      response - response receiving cache headers and, when denied, status 404
      Returns:
      true for 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 isPreview request attribute. If the history is scheduled for publication and its master page has initialized planned media, stores that master ID in PREVIEW_DOC. Viewing an older or unscheduled revision does not select the planned media set.

      Parameters:
      history - loaded history revision whose access has already been checked
      request - request receiving the preview attributes
      response - 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 the PREVIEW_DOC attribute
      docId - page ID whose media are being requested
      Returns:
      true if the selected preview ID matches this page's master ID