Class UserRecord
java.lang.Object
uk.ac.manchester.spinnaker.alloc.model.UserRecord
public final class UserRecord extends Object
The description and model of a user. POJO class. Some things are stated to be
not settable despite having setters; they're settable in instances of
this class but the service itself will not respect being asked to change
them.
-
Constructor Summary
Constructors Constructor Description UserRecord()
Create an empty instance.UserRecord(Row row)
Inflate the result of aSQLQueries.GET_USER_DETAILS
query (or anything else that includes the same columns) into an object. -
Method Summary
Modifier and Type Method Description Boolean
getEnabled()
Map<String,URI>
getGroups()
Note that no API that sets a user's information using aUserRecord
allows setting the groups that user is a member of at the same time.Boolean
getHasPassword()
@Null Instant
getLastFailedLogin()
@Null Instant
getLastSuccessfulLogin()
Boolean
getLocked()
String
getOpenIdSubject()
String
getPassword()
@NotNull(message="a trust level must be given") TrustLevel
getTrustLevel()
@Null Integer
getUserId()
@NotBlank String
getUserName()
void
initCreationDefaults()
Set up some defaults used when a user is being created.boolean
isExternallyAuthenticated()
boolean
isInternal()
UserRecord
sanitise()
Forces correct shrouding of information.void
setEnabled(Boolean enabled)
void
setGroups(Map<String,URI> groups)
void
setHasPassword(Boolean hasPassword)
void
setInternal(boolean internal)
void
setLocked(Boolean locked)
void
setOpenIdSubject(String subject)
void
setPassword(String password)
void
setTrustLevel(TrustLevel trustLevel)
void
setUserId(Integer userId)
void
setUserName(String userName)
-
Constructor Details
-
UserRecord
public UserRecord()Create an empty instance. -
UserRecord
Inflate the result of aSQLQueries.GET_USER_DETAILS
query (or anything else that includes the same columns) into an object. Doesn't include inflating the groups that the user is a member of.- Parameters:
row
- The row with the result.
-
-
Method Details
-
getUserId
- Returns:
- The user identifier. Read-only; cannot be set by the service.
-
setUserId
- Parameters:
userId
- The user identifier. Read-only within the administration interface; cannot be set by the service.
-
getUserName
- Returns:
- The user's username.
-
setUserName
- Parameters:
userName
- The user's username.
-
getPassword
- Returns:
- The user's unencrypted password. Never returned by the service, but may be written.
-
setPassword
- Parameters:
password
- The user's unencrypted password. Never returned by the service, but may be written.
-
getHasPassword
- Returns:
- Whether the user has a password set. If they don't, they'll have to log in by other mechanisms (e.g., HBP/EBRAINS OpenID Connect).
-
setHasPassword
- Parameters:
hasPassword
- Whether the user has a password set. If they don't, they'll have to log in by other mechanisms (e.g., HBP/EBRAINS OpenID Connect).
-
getEnabled
- Returns:
- Whether this account is enabled. Disabled accounts cannot log into the service until explicitly enabled.
-
setEnabled
- Parameters:
enabled
- Whether this account is enabled. Disabled accounts cannot log into the service until explicitly enabled.
-
getLocked
- Returns:
- Whether this account is temporarily locked. Locked accounts
should unlock automatically after 24 hours. Can be explicitly set
to
false
to force an unlock.
-
setLocked
- Parameters:
locked
- Whether this account is temporarily locked. Locked accounts should unlock automatically after 24 hours. Can be explicitly set tofalse
to force an unlock.
-
getTrustLevel
@NotNull(message="a trust level must be given") public @NotNull(message="a trust level must be given") TrustLevel getTrustLevel()- Returns:
- The permissions of the account.
-
setTrustLevel
- Parameters:
trustLevel
- The permissions of the account.
-
getLastSuccessfulLogin
- Returns:
- The time that the last successful login was. Read-only; cannot be set via the admin API.
-
getLastFailedLogin
- Returns:
- The time that the last failed login was. Read-only; cannot be set via the admin API.
-
getGroups
Note that no API that sets a user's information using aUserRecord
allows setting the groups that user is a member of at the same time.- Returns:
- The groups that the user is a member of. May be
null
if this information is not being reported.
-
setGroups
- Parameters:
groups
- The groups that the user is a member of.
-
getOpenIdSubject
- Returns:
- The OpenID subject that this user relates to, if known.
-
setOpenIdSubject
- Parameters:
subject
- The OpenID subject that this user relates to.
-
isInternal
public boolean isInternal()- Returns:
- Whether this is an internal user.
-
setInternal
public void setInternal(boolean internal)- Parameters:
internal
- Whether this is an internal user.
-
isExternallyAuthenticated
public boolean isExternallyAuthenticated()- Returns:
- Whether this represents a request to use external authentication (instead of just not setting the password).
-
sanitise
Forces correct shrouding of information.- Returns:
- the object (for convenience)
-
initCreationDefaults
public void initCreationDefaults()Set up some defaults used when a user is being created.
-