Class JaxbUser

java.lang.Object
org.opencastproject.security.api.JaxbUser
All Implemented Interfaces:
User

public final class JaxbUser extends Object implements User
A simple user model.
  • Field Details

    • userName

      protected String userName
      The user name
    • name

      protected String name
      The user's name
    • email

      protected String email
      The user's email address
    • provider

      protected String provider
      The user's provider
    • isManageable

      protected boolean isManageable
    • roles

      protected Set<JaxbRole> roles
      The roles
    • password

      protected String password
      The optional password. Note that this will never be serialized to xml
    • organization

      protected JaxbOrganization organization
      The user's home organization identifier
  • Constructor Details

    • JaxbUser

      public JaxbUser()
      No-arg constructor needed by JAXB
    • JaxbUser

      public JaxbUser(String userName, String provider, JaxbOrganization organization, JaxbRole... roles) throws IllegalArgumentException
      Constructs a user which is a member of the given organization that has the specified roles and no password set.
      Parameters:
      userName - the username
      provider - the provider
      organization - the organization
      roles - the set of roles for this user
      Throws:
      IllegalArgumentException - if userName or organization is null
    • JaxbUser

      public JaxbUser(String userName, String password, String provider, JaxbOrganization organization, JaxbRole... roles) throws IllegalArgumentException
      Constructs a user which is a member of the given organization that has the specified roles.
      Parameters:
      userName - the username
      password - the password
      provider - the provider
      organization - the organization
      roles - the set of roles for this user
      Throws:
      IllegalArgumentException - if userName or organization is null
    • JaxbUser

      public JaxbUser(String userName, String password, String provider, JaxbOrganization organization, Set<JaxbRole> roles) throws IllegalArgumentException
      Constructs a user which is a member of the given organization that has the specified roles.
      Parameters:
      userName - the username
      password - the password
      provider - the provider
      organization - the organization
      roles - the set of roles for this user
      Throws:
      IllegalArgumentException - if userName or organization is null
    • JaxbUser

      public JaxbUser(String userName, String provider, JaxbOrganization organization, Set<JaxbRole> roles) throws IllegalArgumentException
      Constructs a user which is a member of the given organization that has the specified roles and no password set.
      Parameters:
      userName - the username
      provider - the provider
      organization - the organization
      roles - the set of roles for this user
      Throws:
      IllegalArgumentException - if userName or organization is null
    • JaxbUser

      public JaxbUser(String userName, String password, String name, String email, String provider, JaxbOrganization organization, Set<JaxbRole> roles) throws IllegalArgumentException
      Constructs a user which is a member of the given organization that has the specified roles.
      Parameters:
      userName - the username
      password - the password
      name - the name
      email - the email
      provider - the provider
      organization - the organization
      roles - the set of roles for this user
      Throws:
      IllegalArgumentException - if userName or organization is null
  • Method Details

    • fromUser

      public static JaxbUser fromUser(User user)
      Creates a JAXB user from a regular user object.
      Parameters:
      user - the user
      Returns:
      the JAXB user
    • fromUser

      public static JaxbUser fromUser(User user, Collection<? extends Role> extraRoles)
      Creates a JAXB user from a regular user object with an additional set of roles.
      Parameters:
      user - the user
      Returns:
      the JAXB user
    • getUsername

      public String getUsername()
      Description copied from interface: User
      Gets this user's unique account name.
      Specified by:
      getUsername in interface User
      Returns:
      the account name
      See Also:
    • getPassword

      public String getPassword()
      Description copied from interface: User
      Gets this user's password, if available.
      Specified by:
      getPassword in interface User
      Returns:
      the password
      See Also:
    • getOrganization

      public Organization getOrganization()
      Description copied from interface: User
      Returns the user's organization identifier.
      Specified by:
      getOrganization in interface User
      Returns:
      the organization
      See Also:
    • getRoles

      public Set<Role> getRoles()
      Description copied from interface: User
      Gets the user's roles. For anonymous users, this will return Anonymous.
      Specified by:
      getRoles in interface User
      Returns:
      the user's roles
      See Also:
    • hasRole

      public boolean hasRole(String roleName)
      Description copied from interface: User
      Returns whether the user is in a specific role.
      Specified by:
      hasRole in interface User
      Parameters:
      roleName - the role to check
      Returns:
      whether the role is one of this user's roles
      See Also:
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • getName

      public String getName()
      Description copied from interface: User
      Gets the user's name.
      Specified by:
      getName in interface User
      Returns:
      the user name
    • getEmail

      public String getEmail()
      Description copied from interface: User
      Gets the user's email address.
      Specified by:
      getEmail in interface User
      Returns:
      the user's email address
    • getProvider

      public String getProvider()
      Description copied from interface: User
      Gets the provider where the user is coming from.
      Specified by:
      getProvider in interface User
      Returns:
      the provider where the user is coming from.
    • setProvider

      public void setProvider(String provider)
    • isManageable

      public boolean isManageable()
      Description copied from interface: User
      Returns true if this user object can be managed by Opencast.
      Specified by:
      isManageable in interface User
      Returns:
      true if this user is manageable
    • setManageable

      public void setManageable(boolean isManageable)