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 Details

    • UserRecord

      public UserRecord()
      Create an empty instance.
    • UserRecord

      public UserRecord(Row row)
      Inflate the result of a SQLQueries.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

      @Null public @Null Integer getUserId()
      The user identifier. Read-only; cannot be set by the service.
      Returns:
      The user identifier.
    • setUserId

      public void setUserId(Integer userId)
      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

      @NotBlank public @NotBlank String getUserName()
      Returns The user's username.
      Returns:
      The user's username
    • setUserName

      public void setUserName(String userName)
      Sets the user's username.
      Parameters:
      userName - The user's username.
    • getPassword

      public String getPassword()
      The user's unencrypted password. Should Never be returned by the service.
      Returns:
      The user's unencrypted password
    • setPassword

      public void setPassword(String password)
      Sets the user's unencrypted password. Should Never be returned by the service.
      Parameters:
      password - The user's unencrypted password.
    • getHasPassword

      public Boolean 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

      public void setHasPassword(Boolean hasPassword)
      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

      public Boolean getEnabled()
      Whether this account is enabled. Disabled accounts cannot log into the service until explicitly enabled.
      Returns:
      Whether this account is enabled.
    • setEnabled

      public void setEnabled(Boolean enabled)
      Set whether this account is enabled. Disabled accounts cannot log into the service until explicitly enabled.
      Parameters:
      enabled - Whether this account is enabled.
    • getLocked

      public Boolean getLocked()
      Whether this account is temporarily locked. Locked accounts should unlock automatically after 24 hours. Can be explicitly set to false to force an unlock.
      Returns:
      Whether this account is temporarily locked
    • setLocked

      public void setLocked(Boolean locked)
      Sets whether this account is temporarily locked. Locked accounts should unlock automatically after 24 hours. Can be explicitly set to false to 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

      public void setTrustLevel(TrustLevel trustLevel)
      Sets the permissions of the account.
      Parameters:
      trustLevel - The permissions of the account.
    • getLastSuccessfulLogin

      @Null public @Null Instant 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

      @Null public @Null Instant 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

      public Map<String,URI> getGroups()
      Note that no API that sets a user's information using a UserRecord 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

      public void setGroups(Map<String,URI> groups)
      Sets the groups that the user is a member of.
      Parameters:
      groups - The groups that the user is a member of.
    • getOpenIdSubject

      public String getOpenIdSubject()
      Returns The OpenID subject that this user relates to, if known.
      Returns:
      The OpenID subject that this user relates to, if known
    • setOpenIdSubject

      public void setOpenIdSubject(String subject)
      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

      @CanIgnoreReturnValue public UserRecord 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.