Class User
- All Implemented Interfaces:
ILicensee
,Serializable
,Comparable<User>
,EventListener
,javax.servlet.http.HttpSessionBindingListener
User class.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
ConstantATTRIBUTE_LOGINS="logins"
static final int
ConstantAVATAR_DEFAULT_SIZE=140
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addLicense
(License license) Adds the given license to this ILicensee.Authentication check for regular (i.e. non-OpenID) accounts.void
backupFields.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.int
void
boolean
Getter 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, javax.servlet.http.HttpServletRequest request) get the url for the avatar.getAvatarUrl
(javax.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 Long
Get theid
of 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
.int
getRank()
getRank.long
getScore()
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.int
hashCode()
boolean
boolean
hasPriviledgeForAllTemplates.boolean
hasPrivilegeForAllCategories.boolean
hasPrivilegeForAllSubthemeDiscriminatorValues.boolean
hasPrivilegesForTemplate
(CMSPageTemplate template) hasPrivilegesForTemplate.boolean
isActive()
isActive.boolean
boolean
boolean
isCmsAdmin.boolean
boolean
isGroupMember
(UserGroup group) isGroupMember.boolean
isHasCmsPrivilege
(String privilege) isHasCmsPrivilege.boolean
isHasPrivilege
(String licenseType, String privilege) isHasPrivilege.boolean
Checks whether this user has the permission to delete all ocr-content of one page in crowdsourcing.boolean
Checks whether this user has the permission to set the representative image for the currently open record.boolean
isOpenIdUser.boolean
isSuperuser.boolean
isSuspended.static void
main.void
raiseScore
(int amount) raiseScore.boolean
removeLicense
(License license) Removes the given license from this ILicensee.void
setActivationKey
(String activationKey) Setter for the fieldactivationKey
.void
setActive
(boolean active) Setter for the fieldactive
.void
setAgreedToTermsOfUse
(boolean agreedToTermsOfUse) void
setAvatarFile
(javax.servlet.http.Part uploadedFile) void
setAvatarType
(UserAvatarOption avatarType) protected void
setBCrypt.void
setComments
(String comments) Setter for the fieldcomments
.void
Setter for the fieldcopy
.void
Setter for the fieldemail
.void
setFirstName
(String firstName) Setter for the fieldfirstName
.void
Setter for the fieldid
.void
setLastLogin
(LocalDateTime lastLogin) Setter for the fieldlastLogin
.void
setLastName
(String lastName) Setter for the fieldlastName
.void
setLicenses
(List<License> licenses) Setter for the fieldlicenses
.void
setLocalAvatarUpdated
(Long localAvatarUpdated) boolean
setNewPassword
(String password) Generates salt and a password hash for the given password string.void
setNickName
(String nickName) Setter for the fieldnickName
.void
setOpenIdAccounts
(List<String> openIdAccounts) Setter for the fieldopenIdAccounts
.void
setPasswordHash
(String passwordHash) Setter for the fieldpasswordHash
.void
setScore
(long score) Setter for the fieldscore
.void
setSuperuser
(boolean superuser) Setter for the fieldsuperuser
.void
setSuspended
(boolean suspended) Setter for the fieldsuspended
.void
setTranskribusSession
(TranskribusSession transkribusSession) Setter for the fieldtranskribusSession
.void
setUserProperties
(Map<String, String> userProperties) toString()
void
valueBound
(javax.servlet.http.HttpSessionBindingEvent event) void
valueUnbound
(javax.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
String
object.
-
getDisplayNameEscaped
Deprecated.- Returns:
- HTML-escapted value of
getDisplayName()
-
getUserGroupOwnerships
Returns a list of UserGroups of which this user is the owner.- Returns:
- a
List
object. - Throws:
DAOException
- if any.
-
getUserGroupMemberships
getUserGroupMemberships.
- Returns:
- a
List
object. - Throws:
DAOException
- if any.
-
getUserGroupsWithMembership
Returns a list of UserGroups of which this user is a member.- Returns:
- a
List
object. - Throws:
DAOException
- if any.
-
isGroupMember
isGroupMember.
- Parameters:
group
- aUserGroup
object.- 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
List
object. - 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
- aSet
object.privilegeName
- aString
object.pi
- aString
object.- Returns:
AccessPermission
- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.DAOException
- if any.
-
addLicense
Adds the given license to this ILicensee.- Specified by:
addLicense
in interfaceILicensee
- Parameters:
license
- aLicense
object.- Returns:
- a boolean.
-
removeLicense
Removes the given license from this ILicensee.- Specified by:
removeLicense
in interfaceILicensee
- Parameters:
license
- aLicense
object.- Returns:
- a boolean.
-
isHasCmsPrivilege
public boolean isHasCmsPrivilege(String privilege) throws PresentationException, IndexUnreachableException, DAOException isHasCmsPrivilege.
- Parameters:
privilege
- aString
object.- 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
- aString
object.privilege
- aString
object.- 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_SIZE
and 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
- aString
object.- Returns:
- a boolean.
-
auth
Authentication check for regular (i.e. non-OpenID) accounts.- Parameters:
email
- aString
object.password
- aString
object.- 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:
getLicenses
in interfaceILicensee
- Returns:
- a
List
object.
-
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(javax.servlet.http.HttpSessionBindingEvent event) - Specified by:
valueBound
in interfacejavax.servlet.http.HttpSessionBindingListener
-
valueUnbound
public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event) - Specified by:
valueUnbound
in interfacejavax.servlet.http.HttpSessionBindingListener
-
backupFields
public void backupFields()backupFields.
-
toString
-
setBCrypt
setBCrypt.
- Parameters:
bcrypt
- aBCrypt
object.
-
getId
Get theid
of a user from a URI -
getIdAsURI
getIdAsURI.
- Returns:
- a
URI
object.
-
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:
compareTo
in interfaceComparable<User>
-
main
main.
- Parameters:
args
- an array ofString
objects.
-