Class Owner

java.lang.Object
org.gcube.common.security.Owner

public class Owner extends Object
Represents the owner of a resource or process. An owner can be either a human user or an application. This class stores various attributes of the owner, including their identity, roles, and contact information.
  • Constructor Details

    • Owner

      public Owner(String id, List<String> contextRoles, boolean external, boolean application)
      Constructs an Owner object for a user or application with a set of context-specific roles.
      Parameters:
      id - The unique identifier of the owner.
      contextRoles - A list of roles specific to the current context.
      external - A boolean flag indicating if the owner is an external client.
      application - A boolean flag indicating if the owner is an application rather than a human user.
    • Owner

      public Owner(String id, List<String> contextRoles, String email, String firstName, String lastName, boolean external, boolean application)
      Constructs an Owner object for a human user with context-specific roles and personal details.
      Parameters:
      id - The unique identifier of the owner.
      contextRoles - A list of roles specific to the current context.
      email - The email address of the owner.
      firstName - The first name of the owner.
      lastName - The last name of the owner.
      external - A boolean flag indicating if the owner is an external client.
      application - A boolean flag indicating if the owner is an application.
    • Owner

      public Owner(String id, List<String> contextRoles, List<String> globalRoles, String email, String firstName, String lastName, boolean external, boolean application)
      Constructs an Owner object with both context-specific and global roles, along with personal details.
      Parameters:
      id - The unique identifier of the owner.
      contextRoles - A list of roles specific to the current context.
      globalRoles - A list of roles that apply globally.
      email - The email address of the owner.
      firstName - The first name of the owner.
      lastName - The last name of the owner.
      external - A boolean flag indicating if the owner is an external client.
      application - A boolean flag indicating if the owner is an application.
  • Method Details

    • isApplication

      public boolean isApplication()
      Checks if the owner is an application rather than a human user.
      Returns:
      true if the owner is an application, false otherwise.
    • getId

      public String getId()
      Gets the unique identifier of the owner.
      Returns:
      The owner's unique ID.
    • getRoles

      public List<String> getRoles()
      Returns all roles assigned to the owner, including both global and context-specific roles.
      Returns:
      A list of all roles.
    • getGlobalRoles

      public List<String> getGlobalRoles()
      Returns the roles of the owner that are not specific to a context.
      Returns:
      A list of the global roles.
    • getContextRoles

      public List<String> getContextRoles()
      Returns the roles of the owner that are specific to a particular context.
      Returns:
      A list of the context-specific roles.
    • getEmail

      public String getEmail()
      Gets the email address of the owner.
      Returns:
      The owner's email address.
    • getFirstName

      public String getFirstName()
      Gets the first name of the owner.
      Returns:
      The owner's first name.
    • getLastName

      public String getLastName()
      Gets the last name of the owner.
      Returns:
      The owner's last name.
    • isExternalClient

      public boolean isExternalClient()
      Checks if the owner is an external client.
      Returns:
      true if the owner is an external client, false otherwise.
    • getClientName

      public String getClientName()
      Gets the pretty name of the client application, if applicable (e.g., "Catalogue").
      Returns:
      The client's name.
    • setClientName

      public void setClientName(String clientName)
      Sets the pretty name of the client application.
      Parameters:
      clientName - The name to set for the client.
    • getContactPerson

      public String getContactPerson()
      Gets the username of the user who requested the client application.
      Returns:
      The username of the contact person.
    • setContactPerson

      public void setContactPerson(String contactPerson)
      Sets the username of the user who requested the client application.
      Parameters:
      contactPerson - The username to set for the contact person.
    • getContactOrganisation

      public String getContactOrganisation()
      Gets the name of the organization or community using the client.
      Returns:
      The name of the contact organization.
    • setContactOrganisation

      public void setContactOrganisation(String contactOrganisation)
      Sets the name of the organization or community using the client.
      Parameters:
      contactOrganisation - The name to set for the contact organization.