Get user details

Catalyst Authentication provides some methods to retrieve the details of the application users. You can obtain the user information of the current user, any user, or all users of the application.

Get Details of Current User

The method getCurrentUser() fetches the details of a user on whose scope the function is getting executed. The userManagement reference used in the code snippets is the component instance created earlier.

The promise returned here will be resolved to a JSON object.

    
copy
// get the details of the current user as a promise let userManagement = app.userManagement(); let userPromise = userManagement.getCurrentUser(); userPromise.then(currentUser => { console.log(currentUser); });

A sample response that you will receive for each version is shown below:

    
Node JS
copy
{
zuid: "1005641433",
zaaid: "1005641434",
org_id: "1005641434",
status: "ACTIVE",
is_confirmed: false,
email_id: "p.boyle@zylker.com",
last_name: "Boyle",
created_time: "Aug 12, 2021 12:27 PM",
role_details: { role_name: "App User", role_id: "2305000000006024" },
user_type: "App User",
user_id: "2305000000007745",
locale: "us|en|Asia/Kolkata",
time_zone: "Asia/Kolkata",
project_profiles: []
}
{
zuid: 1005641433,
zaaid: 1005641434,
org_id: 1005641434,
status: "ACTIVE",
is_confirmed: false,
email_id: "p.boyle@zylker.com",
last_name: "Boyle",
created_time: "Aug 12, 2021 12:27 PM",
role_details: { role_name: "App User", role_id: 2305000000006024 },
user_type: "App User",
user_id: 2305000000007745,
locale: "us|en|Asia/Kolkata",
time_zone: "Asia/Kolkata",
project_profiles: []
}

Get User Details by User ID

You can retrieve the details of a particular user by passing the User ID of the user to the getUserDetails() method. The promise is resolved to a JSON object.

    
copy
//Get a single user's details by passing the user ID let userManagement = app.userManagement(); let userPromise = userManagement.getUserDetails(1510000000109587); userPromise.then(userDetails => { console.log(userDetails); });

A sample response that you will receive for each version is shown below:

    
Node JS
copy
{
zuid: "1005665160",
zaaid: "1005665245",
org_id: "1005665245",
status: "ACTIVE",
is_confirmed: false,
email_id: "mikerogers@zylker.com ",
last_name: "Rogers",
created_time: "Aug 17, 2021 04:55 PM",
role_details: { role_name: "App User", role_id: "2136000000007748" },
user_type: "App User",
user_id: "2136000000020040",
locale: "us|en|Asia/Kolkata",
time_zone: "Asia/Kolkata",
project_profiles: []
}
{
zuid: 1005665160,
zaaid: 1005665245,
org_id: 1005665245,
status: "ACTIVE",
is_confirmed: false,
email_id: "mikerogers@zylker.com",
last_name: "Rogers",
created_time: "Aug 17, 2021 04:55 PM",
role_details: { role_name: "App User", role_id: 2136000000007748 },
user_type: "App User",
user_id: 2136000000020040,
locale: "us|en|Asia/Kolkata",
time_zone: "Asia/Kolkata",
project_profiles: []
}

Get Details of All Users

The getAllUsers() method can fetch the details of all the users who are registered with the application.

The promise returned here will be resolved to an array of objects which contains all user details.

    
copy
//Get details of all users let userManagement = app.userManagement(); let allUserPromise = userManagement.getAllUsers(); allUserPromise.then(allUserDetails => { console.log(allUserDetails); });

A sample response that you will receive for each version is shown below:

    
Node JS
copy
[
{
zuid: "1005648252",
zaaid: "1005648253",
org_id: "1005648253",
status: "ACTIVE",
is_confirmed: false,
email_id: "p.boyle@zylker.com",
last_name: "Boyle",
created_time: "Aug 13, 2021 01:36 PM",
modified_time: "Aug 13, 2021 01:36 PM",
invited_time: "Aug 13, 2021 01:36 PM",
role_details: { role_name: "App User", role_id: "2136000000007748" },
user_type: "App User",
user_id: "2136000000007774",
locale: "us|en|Asia/Kolkata",
time_zone: "Asia/Kolkata",
project_profiles: []
},
{
zuid: "1005665160",
zaaid: "1005665245",
org_id: "1005665245",
status: "ACTIVE",
is_confirmed: false,
email_id: "rsmith@zylker.com ",
last_name: "Smith",
created_time: "Aug 17, 2021 04:55 PM",
modified_time: "Aug 17, 2021 04:55 PM",
invited_time: "Aug 17, 2021 04:55 PM",
role_details: { role_name: "App User", role_id: "2136000000007748" },
user_type: "App User",
user_id: "2136000000020040",
locale: "us|en|Asia/Kolkata",
time_zone: "Asia/Kolkata",
project_profiles: []
}
]
[
{
zuid: 1005648252,
zaaid: 1005648253,
org_id: 1005648253,
status: "ACTIVE",
is_confirmed: false,
email_id: "p.boyle@zylker.com",
last_name: "Boyle",
created_time: "Aug 13, 2021 01:36 PM",
modified_time: "Aug 13, 2021 01:36 PM",
invited_time: "Aug 13, 2021 01:36 PM",
role_details: { role_name: "App User", role_id: 2136000000007748 },
user_type: "App User",
user_id: 2136000000007774,
locale: "us|en|Asia/Kolkata",
time_zone: "Asia/Kolkata",
project_profiles: []
},
{
zuid: 1005665160,
zaaid: 1005665245,
org_id: 1005665245,
status: "ACTIVE",
is_confirmed: false,
email_id: "rsmith@zylker.com",
last_name: "Smith",
created_time: "Aug 17, 2021 04:55 PM",
modified_time: "Aug 17, 2021 04:55 PM",
invited_time: "Aug 17, 2021 04:55 PM",
role_details: { role_name: "App User", role_id: 2136000000007748 },
user_type: "App User",
user_id: 2136000000020040,
locale: "us|en|Asia/Kolkata",
time_zone: "Asia/Kolkata",
project_profiles: []
}
]

Last Updated 2023-09-03 01:06:41 +0530 +0530