Package io.goobi.viewer.model.security
Class DownloadTicket
java.lang.Object
io.goobi.viewer.model.security.DownloadTicket
- All Implemented Interfaces:
Serializable
This class describes license types for record access conditions and also system user roles (not to be confused with the class Role, however), also
known as core license types.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Static salt for password hashes.static final int
Default validity for a ticket in days. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activate()
Sets the dates.boolean
checkPassword
(String password) void
extend
(long days) Extends the ticket by anotherdays
days.getEmail()
getId()
Getter for the fieldid
.getLabel()
Returns the title of the associated record, with a fallback to PI.getPi()
getTitle()
boolean
isActive()
boolean
boolean
void
reset()
Resets the ticket's password and expiration date.void
setDateCreated
(LocalDateTime dateCreated) void
void
setExpirationDate
(LocalDateTime expirationDate) void
Setter for the fieldid
.void
setPassword
(String password) void
setPasswordHash
(String passwordHash) void
void
setRequestMessage
(String requestMessage) void
-
Field Details
-
VALIDITY_DAYS
public static final int VALIDITY_DAYSDefault validity for a ticket in days.- See Also:
-
SALT
Static salt for password hashes.- See Also:
-
-
Constructor Details
-
DownloadTicket
public DownloadTicket()Zero argument constructor.
-
-
Method Details
-
isActive
public boolean isActive()- Returns:
- true if ticket granted and not expired; false otherwise
-
isExpired
public boolean isExpired()- Returns:
- true if expiration date is in the past; false otherwise
-
isRequest
public boolean isRequest()- Returns:
- true if ticket is requested but not yet issued; false otherwise
-
checkPassword
- Parameters:
password
- Password to check- Returns:
- true if password correct; false otherwise
-
activate
public void activate()Sets the dates. -
extend
public void extend(long days) Extends the ticket by anotherdays
days.- Parameters:
days
- Number of days to extend
-
reset
public void reset()Resets the ticket's password and expiration date. -
getDefaultValidityAsString
- Returns:
VALIDITY_DAYS
-
getLabel
Returns the title of the associated record, with a fallback to PI.- Returns:
- title if present; otherwise pi
-
getId
Getter for the field
id
.- Returns:
- the id
-
setId
Setter for the field
id
.- Parameters:
id
- the id to set
-
getDateCreated
- Returns:
- the dateCreated
-
setDateCreated
- Parameters:
dateCreated
- the dateCreated to set
-
getExpirationDate
- Returns:
- the expirationDate
-
setExpirationDate
- Parameters:
expirationDate
- the expirationDate to set
-
getPi
- Returns:
- the pi
-
setPi
- Parameters:
pi
- the pi to set
-
getEmail
- Returns:
- the email
-
setEmail
- Parameters:
email
- the email to set
-
getPassword
- Returns:
- the password
-
setPassword
- Parameters:
password
- the password to set
-
getPasswordHash
- Returns:
- the passwordHash
-
setPasswordHash
- Parameters:
passwordHash
- the passwordHash to set
-
getTitle
- Returns:
- the title
-
setTitle
- Parameters:
title
- the title to set
-
getRequestMessage
- Returns:
- the requestMessage
-
setRequestMessage
- Parameters:
requestMessage
- the requestMessage to set
-