Package io.goobi.viewer.model.security
Class RequiredPrivileges
java.lang.Object
io.goobi.viewer.model.security.RequiredPrivileges
Privileges required for accessing a content file, optionally depending on the
SolrConstants.DocType of the Solr document that lists the file. This
allows a single access check query to decide whether a file is e.g. a page image (SolrConstants.DocType.PAGE) or a born-digital download
(SolrConstants.DocType.DOWNLOAD_RESOURCE) without knowing the document type beforehand. All privileges that apply to a document type must be granted.
Instances are immutable.-
Method Summary
Modifier and TypeMethodDescriptionbooleanKey identifying this privilege combination in cached permission session attributes.String[]getPrivileges(SolrConstants.DocType docType) static RequiredPrivilegestoString()withDocType(SolrConstants.DocType docType, String... privileges)
-
Method Details
-
of
- Parameters:
privileges- privileges required for any document type that has no specific mapping- Returns:
- new
RequiredPrivileges
-
withDocType
- Parameters:
docType- document type for which other privileges are requiredprivileges- privileges required for files listed in documents of the given type- Returns:
- new
RequiredPrivilegescontaining the additional mapping; this instance remains unchanged
-
getPrivileges
- Parameters:
docType- document type of the Solr document listing the file; may be null- Returns:
- privileges mapped to docType, or the default privileges if there is no mapping
-
contains
- Parameters:
privilege- privilege name to look for- Returns:
- true if privilege is required for any document type; false otherwise
-
getCacheKey
Key identifying this privilege combination in cached permission session attributes. For a single privilege without document type mappings, this is the privilege name itself so that cache entries are shared with the single-privilege access check methods.- Returns:
- Cache key
-
toString
-