Package sk.iway.iwcm.components.welcome
Class DashboardRecentPagesService
java.lang.Object
sk.iway.iwcm.components.welcome.DashboardRecentPagesService
Provides dashboard search previews and page access checks using current permissions and domain membership.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetPagePreviews(Identity user, String domain, List<Integer> docIds) Loads current thumbnail paths and the latest save by any author for accessible search results.getPagePreviews(Identity user, String domain, List<Integer> docIds, boolean cacheOnly) Loads authorized previews, optionally using only cached page metadata for autocomplete.static booleanisAccessible(DocDetails currentDoc, Identity user, String domain) Checks whether a page is editable in the active domain using its current location.
-
Constructor Details
-
DashboardRecentPagesService
public DashboardRecentPagesService()
-
-
Method Details
-
getPagePreviews
public Map<Integer,DocDetailsDto> getPagePreviews(Identity user, String domain, List<Integer> docIds) Loads current thumbnail paths and the latest save by any author for accessible search results. Pages outside the active domain or the user's editing permissions are omitted; pages without a history save date use their creation date.- Parameters:
user- user whose web page access and editing permissions are checkeddomain- active domain name used to filter the pagesdocIds- non-null list of at most twenty page IDs in the requested order- Returns:
- previews keyed by page ID in request order, excluding inaccessible or missing pages
- Throws:
IllegalArgumentException- if more than twenty page IDs are requestedorg.springframework.security.access.AccessDeniedException- if the user lacks web page accessIllegalStateException- if preview data cannot be loaded from the database
-
getPagePreviews
public Map<Integer,DocDetailsDto> getPagePreviews(Identity user, String domain, List<Integer> docIds, boolean cacheOnly) Loads authorized previews, optionally using only cached page metadata for autocomplete. Cached previews omit the latest save date, which requires a database query.- Parameters:
user- user whose web page access and editing permissions are checkeddomain- active domain name used to filter the pagesdocIds- non-null list of at most twenty page IDs in the requested ordercacheOnly- whether to skip database enrichment of thumbnails and save dates- Returns:
- previews keyed by page ID in request order, excluding inaccessible or missing pages
- Throws:
IllegalArgumentException- if more than twenty page IDs are requestedorg.springframework.security.access.AccessDeniedException- if the user lacks web page accessIllegalStateException- if requested database enrichment fails
-
isAccessible
Checks whether a page is editable in the active domain using its current location. Missing pages and pages in hidden groups or the trash are excluded.- Parameters:
currentDoc- current page details, ornulluser- user whose web page access and editing permissions are checked, ornulldomain- required domain name; a missing or empty value denies access- Returns:
trueif the page passes the location and permission checks
-