Get User Details

Catalyst user management provides some variants to retrieve the details of the app users. It is possible to obtain the user information of the current user, any or all users of the application. 

Get current user details

This variant fetches the details of an user on whose scope the function is getting executed. To know more about function scopes please refer here.

Ensure the following packages are imported:

Copiedimport com.zc.component.ZCUserDetail
import com.zc.component.users.ZCUser
Copied//Create an instance of the ZCUser object to get current user information
ZCUserDetail details = ZCUser.getInstance().getCurrentUser();

Get all the user details

This variant can fetch the details of all the users who are registered with the application. 

Ensure the following packages are imported:

Copiedimport com.zc.component.ZCUserDetail
import com.zc.component.users.ZCUser
Copied//Create an instance of ZCUser and call getAllUser to get all the users in the application
List<ZCUserDetail> details = ZCUser.getInstance().getAllUser();

Get user details by userID

Unlike the previous variant, when you want to retrieve the information of a particular user, you can use this variant where the User Id of the user is passed as a parameter to the getUser() method.

Ensure the following packages are imported:

Copiedimport com.zc.component.ZCUserDetail
import com.zc.component.users.ZCUser
Copied//Create an instance of the ZCUser object and use user id to get user information based on id
ZCUserDetail details = ZCUser.getInstance().getUser(1510000000113214L);