This class represents a user in the framework. This is where you should store the user data, such as:
- uuid : The user’s unique ID. This is a textual value, that must be specified. It can be any text, but it must be unique.
- userName : The user’s username. This is a textual value, that must be specified. This is name is used during the login, and this is the name that is stored in the logs.
- name : The user’s full name. Not mandatory.
- telephoneNumber : The user’s telephone number. Not mandatory.
- email : The user’s E-mail address. Not mandatory.
- roles : The user’s roles. This information must be specified in a list that contains Role objects. A user can have multiple roles.
- currentRole : The user’s current role. This must be specified as a Role Object. This Role must also be listed in the user’s roles (see above). The Role specified here will be used when the user logs in, which is used to determine the user’s access rights.
If these are not sufficient for you, you can create a custom user class, in which you can store additional information. This custom user class has only one requirement, it must extend the CurrentUser class.
This MyUser class can be used the same way as the CurrentUser class, only you can use the user’s age as well.
Retrieving a logged in user
You may need to retrieve a user in the application and the framework provides multiple solutions for this. You can query the user on the client object, and through the UI object. You will receive the currently logged in user’s object. By default, this is the CurrentUser class, but if you made a custom user class, you will receive that class. This allows you to have the additional information that you have specified in the custom user class.
If there is no logged in user, it will return with null.