Package org.localify.auth.dto
Class UserDetailsDto
java.lang.Object
org.localify.auth.dto.UserDetailsDto
Data Transfer Object for user details.
This class is used to transfer user details, including roles, between different parts of the application.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetId()Gets the user's ID.getRoles()Gets the user's roles as a list of strings.Gets the user's roles as a comma-separated string.booleanisAdmin()Checks if the user has the "Admin" role.booleanChecks if the user has the "SuperAdmin" role.booleanChecks if the user has the "TeamMember" role.booleanisUser()Checks if the user has the "User" role.setAdmin(boolean admin) Sets whether the user has the "Admin" role.Sets the user's ID.setSuperAdmin(boolean superAdmin) Sets whether the user has the "SuperAdmin" role.setTeamMember(boolean teamMember) Sets whether the user has the "TeamMember" role.setUser(boolean user) Sets whether the user has the "User" role.
-
Constructor Details
-
UserDetailsDto
public UserDetailsDto()
-
-
Method Details
-
getRolesAsString
Gets the user's roles as a comma-separated string.- Returns:
- The roles as a string.
-
getRoles
Gets the user's roles as a list of strings.- Returns:
- A list of roles.
-
getId
Gets the user's ID.- Returns:
- The user's ID.
-
setId
Sets the user's ID.- Parameters:
id- The user's ID.- Returns:
- This UserDetailsDto instance.
-
isUser
public boolean isUser()Checks if the user has the "User" role.- Returns:
- True if the user is a user, false otherwise.
-
setUser
Sets whether the user has the "User" role.- Parameters:
user- True if the user is a user, false otherwise.- Returns:
- This UserDetailsDto instance.
-
isAdmin
public boolean isAdmin()Checks if the user has the "Admin" role.- Returns:
- True if the user is an admin, false otherwise.
-
setAdmin
Sets whether the user has the "Admin" role.- Parameters:
admin- True if the user is an admin, false otherwise.- Returns:
- This UserDetailsDto instance.
-
isTeamMember
public boolean isTeamMember()Checks if the user has the "TeamMember" role.- Returns:
- True if the user is a team member, false otherwise.
-
setTeamMember
Sets whether the user has the "TeamMember" role.- Parameters:
teamMember- True if the user is a team member, false otherwise.- Returns:
- This UserDetailsDto instance.
-
isSuperAdmin
public boolean isSuperAdmin()Checks if the user has the "SuperAdmin" role.- Returns:
- True if the user is a super admin, false otherwise.
-
setSuperAdmin
Sets whether the user has the "SuperAdmin" role.- Parameters:
superAdmin- True if the user is a super admin, false otherwise.- Returns:
- This UserDetailsDto instance.
-