Class CurrentUser
The class containing the data of the currently logged in user
If the application requires other/more information about the user, above those listed in this class, then a POJO class has to be made, that is a descendant of this class. a descendant of this class.he framework only builds on the information that is in this class, so the descendant class doesn't have any effect on the application itself.
If a custom user class is made, then at the login the custom class has to be instantiated, and given
to the JBStrap framework, as the logged in user. For more information about the login implementation, see: AuthenticationInterface
- Since:
- 4.0
- Author:
- JBStrap
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds the specified role to the userAdds multiple roles to the userAdds the specified list of roles to the usercopy()
Gets the user's current rolegetEmail()
Gets the user's e-mail addressgetName()
Gets the user's full namegetRoles()
Gets the user's rolesGets the user's telephone numberGets the user namegetUuid()
Gets the user's UUIDsetCurrentRole
(Role currentRole) Sets the user's current roleSets the user's e-mail addressSets the user's full nameSets the user's roles.setTelephoneNumber
(String telephoneNumber) Sets the user's telephone numbersetUserName
(String userName) Sets the user nameSets the user's UUIDtoString()
Returns a string representation of the user data
-
Field Details
-
uuid
-
userName
-
name
-
telephoneNumber
-
email
-
roles
-
currentRole
-
-
Constructor Details
-
CurrentUser
public CurrentUser()
-
-
Method Details
-
setUuid
Sets the user's UUID- Parameters:
uuid
- The user's UUID- Returns:
- The user data
-
getUuid
Gets the user's UUID- Returns:
- The user's UUID
-
setUserName
Sets the user name- Parameters:
userName
- The user name- Returns:
- The user data
-
getUserName
Gets the user name- Returns:
- The user name
-
setName
Sets the user's full name- Parameters:
name
- The user's full name- Returns:
- The user data
-
getName
Gets the user's full name- Returns:
- The user's full name
-
getEmail
Gets the user's e-mail address- Returns:
- The user's e-mail address
-
setEmail
Sets the user's e-mail address- Parameters:
email
- The user's e-mail address- Returns:
- The user data
-
getTelephoneNumber
Gets the user's telephone number- Returns:
- The user's telephone number
-
setTelephoneNumber
Sets the user's telephone number- Parameters:
telephoneNumber
- The user's telephone number- Returns:
- The user data
-
getRoles
Gets the user's roles- Returns:
- A list of the roles the user has or
null
, if there aren't any roles assigned to the user
-
setRoles
Sets the user's roles. If this method is used, the previously assigned roles will be lost- Parameters:
roles
- List of the user roles- Returns:
- The user data
-
addRole
Adds the specified role to the user- Parameters:
role
- The user role to be assigned- Returns:
- The user data
-
addRoles
Adds multiple roles to the user- Parameters:
roles
- The user roles to be assigned- Returns:
- The user data
-
addRoles
Adds the specified list of roles to the user- Parameters:
roles
- The list of roles to be added- Returns:
- The user data
-
toString
Returns a string representation of the user data -
getCurrentRole
Gets the user's current role- Returns:
- The user's current role
-
setCurrentRole
Sets the user's current role
A user can only have one active role. If the user has multiple roles, this method can be used to set the currently active user role so that the role can function properly
- Parameters:
currentRole
- The user's current role- Returns:
- The user data
-
copy
-