Class UserRecord
java.lang.Object
uk.ac.manchester.spinnaker.alloc.model.UserRecord
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
ConstructorsConstructorDescriptionCreate an empty instance.UserRecord(Row row) Inflate the result of aSQLQueries.GET_USER_DETAILSquery (or anything else that includes the same columns) into an object. -
Method Summary
Modifier and TypeMethodDescriptionWhether this account is enabled.Note that no API that sets a user's information using aUserRecordallows setting the groups that user is a member of at the same time.Whether the user has a password set.The time that the last failed login was.The time that the last successful login was.Whether this account is temporarily locked.Returns The OpenID subject that this user relates to, if known.The user's unencrypted password.@NotNull(message="a trust level must be given") TrustLevelReturns The permissions of the account.The user identifier.Returns The user's username.voidSet up some defaults used when a user is being created.booleanReturns Whether this represents a request to use external authentication (instead of just not setting the password).booleanReturns Whether this is an internal user.sanitise()Forces correct shrouding of information.voidsetEnabled(Boolean enabled) Set whether this account is enabled.voidSets the groups that the user is a member of.voidsetHasPassword(Boolean hasPassword) Sets whether the user has a password set.voidsetInternal(boolean internal) Sets whether this is an internal user.voidSets whether this account is temporarily locked.voidsetOpenIdSubject(String subject) Sets the OpenID subject that this user relates to.voidsetPassword(String password) Sets the user's unencrypted password.voidsetTrustLevel(TrustLevel trustLevel) Sets the permissions of the account.voidSets the user identifier.voidsetUserName(String userName) Sets the user's username.
-
Constructor Details
-
UserRecord
public UserRecord()Create an empty instance. -
UserRecord
Inflate the result of aSQLQueries.GET_USER_DETAILSquery (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
The user identifier. Read-only; cannot be set by the service.- Returns:
- The user identifier.
-
setUserId
Sets the user identifier. Should be treated as Read-only within the administration interface; and not be set by the service.- Parameters:
userId- The user identifier.
-
getUserName
Returns The user's username.- Returns:
- The user's username
-
setUserName
Sets the user's username.- Parameters:
userName- The user's username.
-
getPassword
The user's unencrypted password. Should Never be returned by the service.- Returns:
- The user's unencrypted password
-
setPassword
Sets the user's unencrypted password. Should Never be returned by the service.- Parameters:
password- The user's unencrypted password.
-
getHasPassword
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).- Returns:
- Whether the user has a password set
-
setHasPassword
Sets 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).- Parameters:
hasPassword- Whether the user has a password set.
-
getEnabled
Whether this account is enabled. Disabled accounts cannot log into the service until explicitly enabled.- Returns:
- Whether this account is enabled.
-
setEnabled
Set whether this account is enabled. Disabled accounts cannot log into the service until explicitly enabled.- Parameters:
enabled- Whether this account is enabled.
-
getLocked
Whether this account is temporarily locked. Locked accounts should unlock automatically after 24 hours. Can be explicitly set tofalseto force an unlock.- Returns:
- Whether this account is temporarily locked
-
setLocked
Sets whether this account is temporarily locked. Locked accounts should unlock automatically after 24 hours. Can be explicitly set tofalseto force an unlock.- Parameters:
locked- Whether this account is temporarily locked.
-
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.- Returns:
- The permissions of the account
-
setTrustLevel
Sets the permissions of the account.- Parameters:
trustLevel- The permissions of the account.
-
getLastSuccessfulLogin
The time that the last successful login was. Read-only; cannot be set via the admin API.- Returns:
- The time that the last successful login was.
-
getLastFailedLogin
The time that the last failed login was. Read-only; cannot be set via the admin API}- Returns:
- The time that the last failed login was.
-
getGroups
Note that no API that sets a user's information using aUserRecordallows 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
nullif this information is not being reported.
-
setGroups
Sets the groups that the user is a member of.- Parameters:
groups- The groups that the user is a member of.
-
getOpenIdSubject
Returns The OpenID subject that this user relates to, if known.- Returns:
- The OpenID subject that this user relates to, if known
-
setOpenIdSubject
Sets the OpenID subject that this user relates to.- Parameters:
subject- The OpenID subject that this user relates to.
-
isInternal
public boolean isInternal()Returns Whether this is an internal user.- Returns:
- Whether this is an internal user
-
setInternal
public void setInternal(boolean internal) Sets whether this is an internal user.- 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).- 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.
-