Class User
- All Implemented Interfaces:
ILicensee,jakarta.servlet.http.HttpSessionBindingListener,Serializable,Comparable<User>,EventListener
User class.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstantATTRIBUTE_LOGINS="logins"static final intConstantAVATAR_DEFAULT_SIZE=140 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddLicense(License license) Adds the given license to this ILicensee.Authentication check for regular (i.e. non-OpenID) accounts.voidbackupFields.canSatisfyAllAccessConditions(Set<String> requiredAccessConditions, String privilegeName, String pi) Checks whether the user can satisfy at least one of the given access conditions with a license that contains the given privilege name.intvoidbooleanGetter for the fieldactivationKey.getAllowedCategories(List<CMSCategory> allCategories) getAllowedCategories.getAllowedSubthemeDiscriminatorValues(List<String> rawValues) getAllowedSubthemeDiscriminatorValues.getAllowedTemplates(List<CMSPageTemplate> allTemplates) getAllowedTemplates.Returns a list of all groups with this user's involvement (either as owner or member).Used by the crowdsourcing module.getAvatarUrl(int size) Used by the crowdsourcing module.getAvatarUrl(int size, jakarta.servlet.http.HttpServletRequest request) get the url for the avatar.getAvatarUrl(jakarta.servlet.http.HttpServletRequest request) Getter for the fieldcomments.getCopy()Getter for the fieldcopy.Returns the name best suited for displaying (depending on which values are available).Deprecated.getEmail()Getter for the fieldemail.Getter for the fieldfirstName.getId()Getter for the fieldid.static LongGet theidof a user from a URIgetIdAsURI.Getter for the fieldlastLogin.Getter for the fieldlastName.getLicenses.getName()getName.Getter for the fieldnickName.Getter for the fieldopenIdAccounts.Getter for the fieldpasswordHash.intgetRank()getRank.longgetScore()Getter for the fieldscore.Getter for the fieldtranskribusSession.getUserGroupMemberships.Returns a list of UserGroups of which this user is the owner.Returns a list of UserGroups of which this user is a member.inthashCode()booleanbooleanhasPriviledgeForAllTemplates.booleanhasPrivilegeForAllCategories.booleanhasPrivilegeForAllSubthemeDiscriminatorValues.booleanhasPrivilegesForTemplate(CMSPageTemplate template) hasPrivilegesForTemplate.booleanisActive()isActive.booleanbooleanbooleanisCmsAdmin.booleanbooleanisGroupMember(UserGroup group) isGroupMember.booleanisHasCmsPrivilege(String privilege) isHasCmsPrivilege.booleanisHasPrivilege(String licenseType, String privilege) isHasPrivilege.booleanChecks whether this user has the permission to delete all ocr-content of one page in crowdsourcing.booleanChecks whether this user has the permission to set the representative image for the currently open record.booleanisOpenIdUser.booleanisSuperuser.booleanisSuspended.static voidmain.voidraiseScore(int amount) raiseScore.booleanremoveLicense(License license) Removes the given license from this ILicensee.voidsetActivationKey(String activationKey) Setter for the fieldactivationKey.voidsetActive(boolean active) Setter for the fieldactive.voidsetAgreedToTermsOfUse(boolean agreedToTermsOfUse) voidsetAvatarFile(jakarta.servlet.http.Part uploadedFile) voidsetAvatarType(UserAvatarOption avatarType) protected voidsetBCrypt.voidsetComments(String comments) Setter for the fieldcomments.voidSetter for the fieldcopy.voidSetter for the fieldemail.voidsetFirstName(String firstName) Setter for the fieldfirstName.voidSetter for the fieldid.voidsetLastLogin(LocalDateTime lastLogin) Setter for the fieldlastLogin.voidsetLastName(String lastName) Setter for the fieldlastName.voidsetLicenses(List<License> licenses) Setter for the fieldlicenses.voidsetLocalAvatarUpdated(Long localAvatarUpdated) booleansetNewPassword(String password) Generates salt and a password hash for the given password string.voidsetNickName(String nickName) Setter for the fieldnickName.voidsetOpenIdAccounts(List<String> openIdAccounts) Setter for the fieldopenIdAccounts.voidsetPasswordHash(String passwordHash) Setter for the fieldpasswordHash.voidsetScore(long score) Setter for the fieldscore.voidsetSuperuser(boolean superuser) Setter for the fieldsuperuser.voidsetSuspended(boolean suspended) Setter for the fieldsuspended.voidsetTranskribusSession(TranskribusSession transkribusSession) Setter for the fieldtranskribusSession.voidsetUserProperties(Map<String, String> userProperties) toString()voidvalueBound(jakarta.servlet.http.HttpSessionBindingEvent event) voidvalueUnbound(jakarta.servlet.http.HttpSessionBindingEvent event) Methods inherited from class io.goobi.viewer.model.security.user.AbstractLicensee
getAccessPermissionFromMap, hasLicense
-
Field Details
-
ATTRIBUTE_LOGINS
ConstantATTRIBUTE_LOGINS="logins"- See Also:
-
AVATAR_DEFAULT_SIZE
public static final int AVATAR_DEFAULT_SIZEConstantAVATAR_DEFAULT_SIZE=140- See Also:
-
-
Constructor Details
-
User
public User()Empty constructor. -
User
- Parameters:
nickname-
-
User
Cloning constructor.- Parameters:
blueprint- User to clone
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
getDisplayName
Returns the name best suited for displaying (depending on which values are available).- Returns:
- a
Stringobject.
-
getDisplayNameEscaped
Deprecated.- Returns:
- HTML-escapted value of
getDisplayName()
-
getUserGroupOwnerships
Returns a list of UserGroups of which this user is the owner.- Returns:
- a
Listobject. - Throws:
DAOException- if any.
-
getUserGroupMemberships
getUserGroupMemberships.
- Returns:
- a
Listobject. - Throws:
DAOException- if any.
-
getUserGroupsWithMembership
Returns a list of UserGroups of which this user is a member.- Returns:
- a
Listobject. - Throws:
DAOException- if any.
-
isGroupMember
isGroupMember.
- Parameters:
group- aUserGroupobject.- Returns:
- a boolean.
- Throws:
DAOException- if any.
-
getAllUserGroups
Returns a list of all groups with this user's involvement (either as owner or member).- Returns:
- a
Listobject. - Throws:
DAOException- if any.
-
canSatisfyAllAccessConditions
public AccessPermission canSatisfyAllAccessConditions(Set<String> requiredAccessConditions, String privilegeName, String pi) throws PresentationException, IndexUnreachableException, DAOException Checks whether the user can satisfy at least one of the given access conditions with a license that contains the given privilege name. If one of the conditions is OPENACCESS, true is always returned. Superusers always get access.- Parameters:
requiredAccessConditions- aSetobject.privilegeName- aStringobject.pi- aStringobject.- Returns:
AccessPermission- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.
-
addLicense
Adds the given license to this ILicensee.- Specified by:
addLicensein interfaceILicensee- Parameters:
license- aLicenseobject.- Returns:
- a boolean.
-
removeLicense
Removes the given license from this ILicensee.- Specified by:
removeLicensein interfaceILicensee- Parameters:
license- aLicenseobject.- Returns:
- a boolean.
-
isHasCmsPrivilege
public boolean isHasCmsPrivilege(String privilege) throws PresentationException, IndexUnreachableException, DAOException isHasCmsPrivilege.
- Parameters:
privilege- aStringobject.- Returns:
- boolean
- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.
-
isHasPrivilege
public boolean isHasPrivilege(String licenseType, String privilege) throws PresentationException, IndexUnreachableException, DAOException isHasPrivilege.
- Parameters:
licenseType- aStringobject.privilege- aStringobject.- Returns:
- boolean
- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.
-
isMaySetRepresentativeImage
public boolean isMaySetRepresentativeImage() throws IndexUnreachableException, PresentationException, DAOExceptionChecks whether this user has the permission to set the representative image for the currently open record. TODO For some reason this method is called 8x in a row.- Returns:
- boolean
- Throws:
IndexUnreachableException- if any.PresentationException- if any.DAOException- if any.
-
isMayDeleteCrowdsourcingFulltext
public boolean isMayDeleteCrowdsourcingFulltext() throws IndexUnreachableException, PresentationException, DAOExceptionChecks whether this user has the permission to delete all ocr-content of one page in crowdsourcing.- Returns:
- a boolean.
- Throws:
IndexUnreachableException- if any.PresentationException- if any.DAOException- if any.
-
isCmsCreator
public boolean isCmsCreator()- Returns:
- true if there are CMS pages or campaigns created by this user; false otherwise
-
getAvatarUrl
get the url for the avatar. If useGravatar is active, returnGravatarUserAvatar.getGravatarUrl(int size). Otherwise build a resource url to 'resources/images/backend/thumbnail_goobi_person.svg' from the request or the JSF-Context if no request is provided- Parameters:
size-request-- Returns:
- Avatar URL
-
getAvatarUrl
Used by the crowdsourcing module.- Returns:
getAvatarUrl(int size, HttpServletRequest request)with size=AVATAR_DEFAULT_SIZEand request=null
-
getAvatarUrl
- Parameters:
request-- Returns:
getAvatarUrl(int size, HttpServletRequest request)with size=AVATAR_DEFAULT_SIZE
-
getAvatarUrl
Used by the crowdsourcing module.- Parameters:
size- a int.- Returns:
getAvatarUrl(int size, HttpServletRequest request)with request=null
-
setNewPassword
Generates salt and a password hash for the given password string.- Parameters:
password- aStringobject.- Returns:
- a boolean.
-
auth
Authentication check for regular (i.e. non-OpenID) accounts.- Parameters:
email- aStringobject.password- aStringobject.- Returns:
- The user, if successful.
- Throws:
AuthenticationException- if any.DAOException- if any.
-
hasPriviledgeForAllTemplates
public boolean hasPriviledgeForAllTemplates()hasPriviledgeForAllTemplates.
- Returns:
- a boolean.
-
hasPrivilegesForTemplate
hasPrivilegesForTemplate.
- Parameters:
template-- Returns:
- true exactly if the user is not restricted to certain cmsTemplates or if the given templateId is among the allowed templates for the user of a usergroup she is in
-
getAllowedTemplates
getAllowedTemplates.
-
hasPrivilegeForAllCategories
public boolean hasPrivilegeForAllCategories()hasPrivilegeForAllCategories.
- Returns:
- a boolean.
-
getAllowedCategories
getAllowedCategories.
-
hasPrivilegeForAllSubthemeDiscriminatorValues
public boolean hasPrivilegeForAllSubthemeDiscriminatorValues()hasPrivilegeForAllSubthemeDiscriminatorValues.
- Returns:
- a boolean.
-
getAllowedSubthemeDiscriminatorValues
getAllowedSubthemeDiscriminatorValues.
- Parameters:
rawValues- All possible values- Returns:
- filtered list of allowed values
-
getId
Getter for the field
id.- Returns:
- the id
-
setId
Setter for the field
id.- Parameters:
id- the id to set
-
getPasswordHash
Getter for the field
passwordHash.- Returns:
- the passwordHash
-
setPasswordHash
Setter for the field
passwordHash.- Parameters:
passwordHash- the passwordHash to set
-
getActivationKey
Getter for the field
activationKey.- Returns:
- the activationKey
-
setActivationKey
Setter for the field
activationKey.- Parameters:
activationKey- the activationKey to set
-
getLastLogin
Getter for the field
lastLogin.- Returns:
- the lastLogin
-
setLastLogin
Setter for the field
lastLogin.- Parameters:
lastLogin- the lastLogin to set
-
isActive
public boolean isActive()isActive.
- Returns:
- the active
-
setActive
public void setActive(boolean active) Setter for the field
active.- Parameters:
active- the active to set
-
isSuspended
public boolean isSuspended()isSuspended.
- Returns:
- the suspended
-
setSuspended
public void setSuspended(boolean suspended) Setter for the field
suspended.- Parameters:
suspended- the suspended to set
-
getNickName
Getter for the field
nickName.- Returns:
- the nickName
-
setNickName
Setter for the field
nickName.- Parameters:
nickName- the nickName to set
-
getLastName
Getter for the field
lastName.- Returns:
- the lastName
-
setLastName
Setter for the field
lastName.- Parameters:
lastName- the lastName to set
-
getFirstName
Getter for the field
firstName.- Returns:
- the firstName
-
setFirstName
Setter for the field
firstName.- Parameters:
firstName- the firstName to set
-
getOpenIdAccounts
Getter for the field
openIdAccounts.- Returns:
- the openIdAccounts
-
setOpenIdAccounts
Setter for the field
openIdAccounts.- Parameters:
openIdAccounts- the openIdAccounts to set
-
setEmail
Setter for the field
email.- Parameters:
email- the email to set
-
getEmail
Getter for the field
email.- Returns:
- the email
-
getComments
Getter for the field
comments.- Returns:
- the comments
-
setComments
Setter for the field
comments.- Parameters:
comments- the comments to set
-
getScore
public long getScore()Getter for the field
score.- Returns:
- the score
-
setScore
public void setScore(long score) Setter for the field
score.- Parameters:
score- the score to set
-
isAnonymous
public boolean isAnonymous()- Returns:
- true if user email address equals the configured anonymous user address; false otherwise
-
raiseScore
raiseScore.
- Parameters:
amount- a int.- Throws:
DAOException- if any.
-
getRank
public int getRank()getRank.
- Returns:
- a int.
-
getLicenses
getLicenses.
- Specified by:
getLicensesin interfaceILicensee- Returns:
- a
Listobject.
-
setLicenses
Setter for the field
licenses.- Parameters:
licenses- the licenses to set
-
getUserProperties
- Returns:
- the userProperties
-
setUserProperties
- Parameters:
userProperties- the userProperties to set
-
isSuperuser
public boolean isSuperuser()isSuperuser.
- Returns:
- the superuser
-
isCmsAdmin
public boolean isCmsAdmin()isCmsAdmin.
- Returns:
- true if user is superuser or has CMS-specific privileges
-
setSuperuser
public void setSuperuser(boolean superuser) Setter for the field
superuser.- Parameters:
superuser- the superuser to set
-
isOpenIdUser
public boolean isOpenIdUser()isOpenIdUser.
- Returns:
- a boolean.
-
getCopy
Getter for the field
copy.- Returns:
- the copy
-
setCopy
Setter for the field
copy.- Parameters:
copy- the copy to set
-
getTranskribusSession
Getter for the field
transkribusSession.- Returns:
- the transkribusSession
-
setTranskribusSession
Setter for the field
transkribusSession.- Parameters:
transkribusSession- the transkribusSession to set
-
getName
getName.
Required by the ILicensee interface. -
valueBound
public void valueBound(jakarta.servlet.http.HttpSessionBindingEvent event) - Specified by:
valueBoundin interfacejakarta.servlet.http.HttpSessionBindingListener
-
valueUnbound
public void valueUnbound(jakarta.servlet.http.HttpSessionBindingEvent event) - Specified by:
valueUnboundin interfacejakarta.servlet.http.HttpSessionBindingListener
-
backupFields
public void backupFields()backupFields.
-
toString
-
setBCrypt
setBCrypt.
- Parameters:
bcrypt- aBCryptobject.
-
getId
Get theidof a user from a URI -
getIdAsURI
getIdAsURI.
- Returns:
- a
URIobject.
-
setAgreedToTermsOfUse
public void setAgreedToTermsOfUse(boolean agreedToTermsOfUse) - Parameters:
agreedToTermsOfUse- the agreedToTermsOfUse to set
-
isAgreedToTermsOfUse
public boolean isAgreedToTermsOfUse()- Returns:
- the agreedToTermsOfUse
-
getAvatarType
- Returns:
- the avatarType
-
setAvatarType
- Parameters:
avatarType- the avatarType to set
-
hasLocalAvatarImage
public boolean hasLocalAvatarImage() -
setAvatarFile
- Throws:
IOException
-
deleteAvatarFile
- Throws:
IOException
-
getLocalAvatarUpdated
- Returns:
- the localAvatarUpdated
-
setLocalAvatarUpdated
- Parameters:
localAvatarUpdated- the localAvatarUpdated to set
-
getBackendDisplayName
-
compareTo
- Specified by:
compareToin interfaceComparable<User>
-
main
main.
- Parameters:
args- an array ofStringobjects.
-