Package org.gcube.common.security
Class Owner
java.lang.Object
org.gcube.common.security.Owner
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 Summary
ConstructorsConstructorDescriptionConstructs anOwnerobject for a user or application with a set of context-specific roles.Owner(String id, List<String> contextRoles, String email, String firstName, String lastName, boolean external, boolean application) Constructs anOwnerobject for a human user with context-specific roles and personal details.Owner(String id, List<String> contextRoles, List<String> globalRoles, String email, String firstName, String lastName, boolean external, boolean application) Constructs anOwnerobject with both context-specific and global roles, along with personal details. -
Method Summary
Modifier and TypeMethodDescriptionGets the pretty name of the client application, if applicable (e.g., "Catalogue").Gets the name of the organization or community using the client.Gets the username of the user who requested the client application.Returns the roles of the owner that are specific to a particular context.getEmail()Gets the email address of the owner.Gets the first name of the owner.Returns the roles of the owner that are not specific to a context.getId()Gets the unique identifier of the owner.Gets the last name of the owner.getRoles()Returns all roles assigned to the owner, including both global and context-specific roles.booleanChecks if the owner is an application rather than a human user.booleanChecks if the owner is an external client.voidsetClientName(String clientName) Sets the pretty name of the client application.voidsetContactOrganisation(String contactOrganisation) Sets the name of the organization or community using the client.voidsetContactPerson(String contactPerson) Sets the username of the user who requested the client application.
-
Constructor Details
-
Owner
Constructs anOwnerobject 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 anOwnerobject 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 anOwnerobject 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:
trueif the owner is an application,falseotherwise.
-
getId
Gets the unique identifier of the owner.- Returns:
- The owner's unique ID.
-
getRoles
Returns all roles assigned to the owner, including both global and context-specific roles.- Returns:
- A list of all roles.
-
getGlobalRoles
Returns the roles of the owner that are not specific to a context.- Returns:
- A list of the global roles.
-
getContextRoles
Returns the roles of the owner that are specific to a particular context.- Returns:
- A list of the context-specific roles.
-
getEmail
Gets the email address of the owner.- Returns:
- The owner's email address.
-
getFirstName
Gets the first name of the owner.- Returns:
- The owner's first name.
-
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:
trueif the owner is an external client,falseotherwise.
-
getClientName
Gets the pretty name of the client application, if applicable (e.g., "Catalogue").- Returns:
- The client's name.
-
setClientName
Sets the pretty name of the client application.- Parameters:
clientName- The name to set for the client.
-
getContactPerson
Gets the username of the user who requested the client application.- Returns:
- The username of the contact person.
-
setContactPerson
Sets the username of the user who requested the client application.- Parameters:
contactPerson- The username to set for the contact person.
-
getContactOrganisation
Gets the name of the organization or community using the client.- Returns:
- The name of the contact organization.
-
setContactOrganisation
Sets the name of the organization or community using the client.- Parameters:
contactOrganisation- The name to set for the contact organization.
-