Package io.goobi.viewer.model.security
Class License
java.lang.Object
io.goobi.viewer.model.security.AbstractPrivilegeHolder
io.goobi.viewer.model.security.License
- All Implemented Interfaces:
IPrivilegeHolder,Serializable
Represents an access licence assigned to a user, user group, or IP range, controlling permissions for specific access conditions.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumClassifies the kind of principal (user, user group, IP range, or client application) that holds aLicense. -
Field Summary
Fields inherited from class io.goobi.viewer.model.security.AbstractPrivilegeHolder
PRIVS_CMS, PRIVS_RECORDFields inherited from interface io.goobi.viewer.model.security.IPrivilegeHolder
PREFIX_PRIV, PREFIX_TICKET, PRIV_ARCHIVE_DISPLAY_NODE, PRIV_CMS_ALL_CATEGORIES, PRIV_CMS_ALL_SUBTHEMES, PRIV_CMS_ALL_TEMPLATES, PRIV_CMS_CATEGORIES, PRIV_CMS_COLLECTIONS, PRIV_CMS_MENU, PRIV_CMS_PAGES, PRIV_CMS_STATIC_PAGES, PRIV_CROWDSOURCING_ALL_CAMPAIGNS, PRIV_CROWDSOURCING_ANNOTATE_CAMPAIGN, PRIV_CROWDSOURCING_REVIEW_CAMPAIGN, PRIV_DELETE_OCR_PAGE, PRIV_DOWNLOAD_BORN_DIGITAL_FILES, PRIV_DOWNLOAD_IMAGES, PRIV_DOWNLOAD_METADATA, PRIV_DOWNLOAD_ORIGINAL_CONTENT, PRIV_DOWNLOAD_PAGE_PDF, PRIV_DOWNLOAD_PDF, PRIV_GENERATE_IIIF_MANIFEST, PRIV_LEGAL_DISCLAIMER, PRIV_LIST, PRIV_SET_REPRESENTATIVE_IMAGE, PRIV_VIEW_AUDIO, PRIV_VIEW_CMS, PRIV_VIEW_FULLTEXT, PRIV_VIEW_IMAGES, PRIV_VIEW_METADATA, PRIV_VIEW_THUMBNAILS, PRIV_VIEW_UGC, PRIV_VIEW_VIDEO, PRIV_ZOOM_IMAGES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanaddPrivilege(String privilege) Adds the given privilege to the working set.booleanGetter for the fieldallowedCategories.Getter for the fieldallowedCmsTemplates.Getter for the fieldallowedCrowdsourcingCampaigns.Returns the list of available record privileges for adding to this license (using the working copy while editing).getAvailablePrivileges(Set<String> privileges) Returns the list of available record privileges for adding to this license (using the given privileges list).Deprecated.Deprecated.Getter for the fieldconditions.Getter for the fielddescription.Convenience method for disabling the save button.getEnd()Getter for the fieldend.getId()Getter for the fieldid.Deprecated.Getter for the fieldlicenseType.Getter for the fieldprivileges.A.getSortedPrivileges(Set<String> privileges) Returns a sorted list (according to the static array of privileges, either for records or CMS) based on the given set of privileges.getStart()Getter for the fieldstart.Getter for the fieldsubthemeDiscriminatorValues.getUser()Deprecated.Deprecated.inthashCode()booleanhasPrivilege(String privilege) hasPrivilege.booleanbooleanbooleanbooleanisPrivCmsAllCategories.booleanisPrivCmsAllSubthemes.booleanisPrivCmsAllTemplates.booleanisPrivCmsCategories.booleanisPrivCmsCollections.booleanisPrivCmsMenu.booleanisPrivCmsPages.booleanisPrivCmsStaticPages.booleanisPrivCrowdsourcingAllCampaigns.booleanisPrivCrowdsourcingAnnotateCampaign.booleanisPrivCrowdsourcingReviewCampaign.booleanisPrivViewUgc.booleanbooleanisValid()Checks the validity of this license.voidremoveLicensee(LicenseRightsHolder licensee) booleanremovePrivilege(String privilege) Removes the given privilege from the working set.voidResets all working copies of lists of various privileges.voidsetAllowedCategories(List<CMSCategory> allowedCategories) Setter for the fieldallowedCategories.voidsetAllowedCmsTemplates(List<CMSPageTemplate> allowedCmsTemplates) Setter for the fieldallowedCmsTemplates.voidsetAllowedCrowdsourcingCampaigns(List<Campaign> allowedCrowdsourcingCampaigns) Setter for the fieldallowedCrowdsourcingCampaigns.voidsetClient(ClientApplication client) Deprecated.voidsetConditions(String conditions) Setter for the fieldconditions.voidsetDescription(String description) Setter for the fielddescription.voidsetEnd(LocalDateTime end) Setter for the fieldend.voidSetter for the fieldid.voidsetIpRange(IpRange ipRange) Deprecated.voidsetLicensees(List<LicenseRightsHolder> licensees) voidsetLicenseType(LicenseType licenseType) Setter for the fieldlicenseType.voidsetPrivCmsAllCategories(boolean priv) setPrivCmsAllCategories.voidsetPrivCmsAllSubthemes(boolean priv) setPrivCmsAllSubthemes.voidsetPrivCmsAllTemplates(boolean priv) setPrivCmsAllTemplates.voidsetPrivCmsCategories(boolean priv) setPrivCmsCategories.voidsetPrivCmsCollections(boolean priv) setPrivCmsCollections.voidsetPrivCmsMenu(boolean priv) setPrivCmsMenu.voidsetPrivCmsPages(boolean priv) setPrivCmsPages.voidsetPrivCmsStaticPages(boolean priv) setPrivCmsStaticPages.voidsetPrivCrowdsourcingAllCampaigns(boolean priv) setPrivCrowdsourcingAllCampaigns.voidsetPrivCrowdsourcingAnnotateCampaign(boolean priv) setPrivCrowdsourcingAnnotateCampaign.voidsetPrivCrowdsourcingReviewCampaign(boolean priv) setPrivCrowdsourcingReviewCampaign.voidsetPrivileges(Set<String> privileges) Setter for the fieldprivileges.voidsetPrivilegesCopy(Set<String> privilegesCopy) voidsetPrivViewUgc(boolean priv) setPrivViewUgc.voidsetStart(LocalDateTime start) Setter for the fieldstart.voidsetSubthemeDiscriminatorValues(List<String> subthemeDiscriminatorValues) Setter for the fieldsubthemeDiscriminatorValues.voidsetTicketRequired(boolean ticketRequired) voidDeprecated.voidsetUserGroup(UserGroup userGroup) Deprecated.
-
Constructor Details
-
License
public License()Zero-arg constructor.
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
isValid
public boolean isValid()Checks the validity of this license. A valid license is either not time limited (start and/or end) or the current date lies between the license's start and and dates.- Returns:
- true if valid; false otherwise;
-
addPrivilege
Adds the given privilege to the working set.- Specified by:
addPrivilegein interfaceIPrivilegeHolder- Parameters:
privilege- Privilege name to add to working set- Returns:
- true if successful; false otherwise
-
removePrivilege
Removes the given privilege from the working set.- Specified by:
removePrivilegein interfaceIPrivilegeHolder- Parameters:
privilege- Privilege name to remove from working set- Returns:
- true if successful; false otherwise
-
hasPrivilege
hasPrivilege.- Specified by:
hasPrivilegein interfaceIPrivilegeHolder- Parameters:
privilege- privilege name constant to check- Returns:
- true if this holder has the given privilege, false otherwise
-
isPrivCmsPages
public boolean isPrivCmsPages()isPrivCmsPages.- Specified by:
isPrivCmsPagesin interfaceIPrivilegeHolder- Returns:
- true if this holder has the privilege to manage CMS pages, false otherwise
-
setPrivCmsPages
public void setPrivCmsPages(boolean priv) setPrivCmsPages.- Specified by:
setPrivCmsPagesin interfaceIPrivilegeHolder- Parameters:
priv- true to grant CMS pages privilege
-
isPrivCmsAllSubthemes
public boolean isPrivCmsAllSubthemes()isPrivCmsAllSubthemes.- Specified by:
isPrivCmsAllSubthemesin interfaceIPrivilegeHolder- Returns:
- true if this holder has the privilege to access all CMS subthemes, false otherwise
-
setPrivCmsAllSubthemes
public void setPrivCmsAllSubthemes(boolean priv) setPrivCmsAllSubthemes.- Specified by:
setPrivCmsAllSubthemesin interfaceIPrivilegeHolder- Parameters:
priv- true to grant all CMS subthemes privilege
-
isPrivCmsAllCategories
public boolean isPrivCmsAllCategories()isPrivCmsAllCategories.- Specified by:
isPrivCmsAllCategoriesin interfaceIPrivilegeHolder- Returns:
- true if this holder has the privilege to access all CMS categories, false otherwise
-
setPrivCmsAllCategories
public void setPrivCmsAllCategories(boolean priv) setPrivCmsAllCategories.- Specified by:
setPrivCmsAllCategoriesin interfaceIPrivilegeHolder- Parameters:
priv- true to grant all CMS categories privilege
-
isPrivCmsAllTemplates
public boolean isPrivCmsAllTemplates()isPrivCmsAllTemplates.- Specified by:
isPrivCmsAllTemplatesin interfaceIPrivilegeHolder- Returns:
- true if this holder has the privilege to access all CMS page templates, false otherwise
-
setPrivCmsAllTemplates
public void setPrivCmsAllTemplates(boolean priv) setPrivCmsAllTemplates.- Specified by:
setPrivCmsAllTemplatesin interfaceIPrivilegeHolder- Parameters:
priv- true to grant all CMS templates privilege
-
isPrivCmsMenu
public boolean isPrivCmsMenu()isPrivCmsMenu.- Specified by:
isPrivCmsMenuin interfaceIPrivilegeHolder- Returns:
- true if this holder has the privilege to manage the CMS navigation menu, false otherwise
-
setPrivCmsMenu
public void setPrivCmsMenu(boolean priv) setPrivCmsMenu.- Specified by:
setPrivCmsMenuin interfaceIPrivilegeHolder- Parameters:
priv- true to grant CMS menu privilege
-
isPrivCmsStaticPages
public boolean isPrivCmsStaticPages()isPrivCmsStaticPages.- Specified by:
isPrivCmsStaticPagesin interfaceIPrivilegeHolder- Returns:
- true if this holder has the privilege to manage CMS static pages, false otherwise
-
setPrivCmsStaticPages
public void setPrivCmsStaticPages(boolean priv) setPrivCmsStaticPages.- Specified by:
setPrivCmsStaticPagesin interfaceIPrivilegeHolder- Parameters:
priv- true to grant CMS static pages privilege
-
isPrivCmsCollections
public boolean isPrivCmsCollections()isPrivCmsCollections.- Specified by:
isPrivCmsCollectionsin interfaceIPrivilegeHolder- Returns:
- true if this holder has the privilege to manage CMS collections, false otherwise
-
setPrivCmsCollections
public void setPrivCmsCollections(boolean priv) setPrivCmsCollections.- Specified by:
setPrivCmsCollectionsin interfaceIPrivilegeHolder- Parameters:
priv- true to grant CMS collections privilege
-
isPrivCmsCategories
public boolean isPrivCmsCategories()isPrivCmsCategories.- Specified by:
isPrivCmsCategoriesin interfaceIPrivilegeHolder- Returns:
- true if this holder has the privilege to manage CMS categories, false otherwise
-
setPrivCmsCategories
public void setPrivCmsCategories(boolean priv) setPrivCmsCategories.- Specified by:
setPrivCmsCategoriesin interfaceIPrivilegeHolder- Parameters:
priv- true to grant CMS categories privilege
-
isPrivCrowdsourcingAllCampaigns
public boolean isPrivCrowdsourcingAllCampaigns()isPrivCrowdsourcingAllCampaigns.- Specified by:
isPrivCrowdsourcingAllCampaignsin interfaceIPrivilegeHolder- Returns:
- true if this holder has the privilege to access all crowdsourcing campaigns, false otherwise
-
setPrivCrowdsourcingAllCampaigns
public void setPrivCrowdsourcingAllCampaigns(boolean priv) setPrivCrowdsourcingAllCampaigns.- Specified by:
setPrivCrowdsourcingAllCampaignsin interfaceIPrivilegeHolder- Parameters:
priv- true to grant all crowdsourcing campaigns privilege
-
isPrivCrowdsourcingAnnotateCampaign
public boolean isPrivCrowdsourcingAnnotateCampaign()isPrivCrowdsourcingAnnotateCampaign.- Specified by:
isPrivCrowdsourcingAnnotateCampaignin interfaceIPrivilegeHolder- Returns:
- true if this holder has the privilege to annotate in crowdsourcing campaigns, false otherwise
-
setPrivCrowdsourcingAnnotateCampaign
public void setPrivCrowdsourcingAnnotateCampaign(boolean priv) setPrivCrowdsourcingAnnotateCampaign.- Specified by:
setPrivCrowdsourcingAnnotateCampaignin interfaceIPrivilegeHolder- Parameters:
priv- true to grant crowdsourcing annotate campaign privilege
-
isPrivCrowdsourcingReviewCampaign
public boolean isPrivCrowdsourcingReviewCampaign()isPrivCrowdsourcingReviewCampaign.- Specified by:
isPrivCrowdsourcingReviewCampaignin interfaceIPrivilegeHolder- Returns:
- true if this holder has the privilege to review crowdsourcing campaign contributions, false otherwise
-
setPrivCrowdsourcingReviewCampaign
public void setPrivCrowdsourcingReviewCampaign(boolean priv) setPrivCrowdsourcingReviewCampaign.- Specified by:
setPrivCrowdsourcingReviewCampaignin interfaceIPrivilegeHolder- Parameters:
priv- true to grant crowdsourcing review campaign privilege
-
isPrivViewUgc
public boolean isPrivViewUgc()Description copied from interface:IPrivilegeHolderisPrivViewUgc.- Specified by:
isPrivViewUgcin interfaceIPrivilegeHolder- Returns:
- true if this holder has the privilege to view user-generated content (UGC), false otherwise
-
setPrivViewUgc
public void setPrivViewUgc(boolean priv) Description copied from interface:IPrivilegeHoldersetPrivViewUgc.- Specified by:
setPrivViewUgcin interfaceIPrivilegeHolder- Parameters:
priv- true to grant view UGC privilege
-
resetTempData
public void resetTempData()Resets all working copies of lists of various privileges. -
getAvailablePrivileges
Returns the list of available record privileges for adding to this license (using the working copy while editing).- Returns:
- Values in IPrivilegeHolder.PRIVS_RECORD minus the privileges already added
-
getAvailablePrivileges
Returns the list of available record privileges for adding to this license (using the given privileges list).- Parameters:
privileges- Currently assigned privileges to exclude from result- Returns:
- Values in IPrivilegeHolder.PRIVS_RECORD minus the privileges already added
-
getSortedPrivileges
Returns a sorted list (according to the static array of privileges, either for records or CMS) based on the given set of privileges.- Specified by:
getSortedPrivilegesin interfaceIPrivilegeHolder- Parameters:
privileges- Listed privileges- Returns:
- Sorted list of privileges contained in
privileges
-
getSelectableSubthemes
- Returns:
- List<Selectablei<String>>
- Throws:
DAOExceptionPresentationException
-
getSelectableCategories
- Returns:
- List<Selectable<CMSCategory>>
- Throws:
DAOException
-
getSelectableTemplates
- Returns:
- List<Selectable<CMSPageTemplate>>
- Throws:
DAOException
-
getId
Getter for the fieldid.- Returns:
- the database primary key for this license
-
setId
Setter for the fieldid.- Parameters:
id- the database primary key for this license
-
getLicenseType
Getter for the fieldlicenseType.- Returns:
- the license type defining the access conditions and privileges for this license
-
setLicenseType
Setter for the fieldlicenseType.- Parameters:
licenseType- the license type defining the access conditions and privileges for this license
-
getLicensees
-
setLicensees
-
getUser
Deprecated.Getter for the fielduser.- Returns:
- the user this license is granted to, or null if granted to a group or IP range
-
setUser
Deprecated.Setter for the fielduser.- Parameters:
user- the user this license is granted to (clears userGroup and ipRange when non-null)
-
getUserGroup
Deprecated.Getter for the fielduserGroup.- Returns:
- the user group this license is granted to, or null if granted to a user or IP range
-
setUserGroup
Deprecated.Setter for the fielduserGroup.- Parameters:
userGroup- the user group this license is granted to (clears user and ipRange when non-null)
-
getIpRange
Deprecated.Getter for the fieldipRange.- Returns:
- the IP range this license is granted to, or null if granted to a user or user group
-
setIpRange
Deprecated.Setter for the fieldipRange.- Parameters:
ipRange- the IP range this license is granted to (clears user and userGroup when non-null)
-
getStart
Getter for the fieldstart.- Returns:
- the date/time from which this license becomes valid, or null if there is no start restriction
-
setStart
Setter for the fieldstart.- Parameters:
start- the date/time from which this license becomes valid; null means no start restriction
-
getEnd
Getter for the fieldend.- Returns:
- the date/time after which this license expires, or null if there is no end restriction
-
setEnd
Setter for the fieldend.- Parameters:
end- the date/time after which this license expires; null means no end restriction
-
getPrivileges
Getter for the fieldprivileges.- Returns:
- the set of privilege names granted by this license
-
setPrivileges
Setter for the fieldprivileges.- Parameters:
privileges- the set of privilege names granted by this license
-
getConditions
Getter for the fieldconditions.- Returns:
- the Solr query expression restricting the records this license applies to
-
setConditions
Setter for the fieldconditions.- Parameters:
conditions- the Solr query expression restricting the records this license applies to
-
getDescription
Getter for the fielddescription.- Returns:
- the human-readable description of this license
-
setDescription
Setter for the fielddescription.- Parameters:
description- the human-readable description of this license
-
isTicketRequired
public boolean isTicketRequired() -
setTicketRequired
public void setTicketRequired(boolean ticketRequired) -
isDisplayTicketRequiredToggle
public boolean isDisplayTicketRequiredToggle()- Returns:
- true if privilege PRIV_DOWNLOAD_BORN_DIGITAL_FILES is contained; false otherwise
-
getSubthemeDiscriminatorValues
Getter for the fieldsubthemeDiscriminatorValues.- Returns:
- the list of subtheme discriminator values that restrict the scope of this license
-
setSubthemeDiscriminatorValues
Setter for the fieldsubthemeDiscriminatorValues.- Parameters:
subthemeDiscriminatorValues- the list of subtheme discriminator values that restrict the scope of this license
-
getAllowedCategories
Getter for the fieldallowedCategories.- Returns:
- the list of CMS categories accessible under this license
-
setAllowedCategories
Setter for the fieldallowedCategories.- Parameters:
allowedCategories- the list of CMS categories accessible under this license
-
getAllowedCmsTemplates
Getter for the fieldallowedCmsTemplates.- Returns:
- the list of CMS page templates accessible under this license
-
setAllowedCmsTemplates
Setter for the fieldallowedCmsTemplates.- Parameters:
allowedCmsTemplates- the list of CMS page templates accessible under this license
-
getAllowedCrowdsourcingCampaigns
Getter for the fieldallowedCrowdsourcingCampaigns.- Returns:
- the list of crowdsourcing campaigns accessible under this license
-
setAllowedCrowdsourcingCampaigns
Setter for the fieldallowedCrowdsourcingCampaigns.- Parameters:
allowedCrowdsourcingCampaigns- the list of crowdsourcing campaigns accessible under this license
-
getPrivilegesCopy
-
setPrivilegesCopy
-
getDisclaimerScope
-
getClientId
Deprecated. -
getClient
Deprecated. -
setClient
Deprecated. -
addLicensee
public void addLicensee() -
removeLicensee
-
isHasLicensees
public boolean isHasLicensees()- Returns:
- true if at least one of user/userGroup/ipRange/client are non-null; false otherwise
-
isHasMultipleLicensees
public boolean isHasMultipleLicensees()- Returns:
- true if at least two of user/userGroup/ipRange/client are non-null; false otherwise
-
getSecondaryAccessRequirement
A.- Returns:
- The other non-null member of user/userGroup/ipRange/client
-
getDisabledStatus
Convenience method for disabling the save button.- Returns:
- "disabled" if any required values are missing; null otherwise
-