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 Current User Details

The method getCurrentProjectUser() 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 an object in which the content key contains the details of the current user of the application.

Copied//Get the details of the current user
var userManagement = catalyst.userManagement;
var currentUserPromise = userManagement.getCurrentProjectUser();
currentUserPromise
        .then((response) => {
            console.log(response.content);
        })
        .catch((err) => {
            console.log(err);
        });

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

Web SDK

Copied{
  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: []
}
Copied{
  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 get() method. The user reference used in the code snippet below is the user object created earlier.

The promise returned here will be resolved to an object in which the content key contains the details of the specific user.

Copied//Get a single user's details by passing the User ID
var userManagement = catalyst.userManagement;
var user = userManagement.userId(USER_ID);
var userPromise = user.get();
userPromise
        .then((response) => {
            console.log(response.content);
        })
        .catch((err) => {
            console.log(err);
        });

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

Web SDK

Copied{
  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: []
}
Copied{
  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 getAllProjectUsers() method can fetch the details of all the users who are registered with the application. The promise returned here will be resolved to an object in which the content key contains an array of user objects.

Copied//Get details of all users
var userManagement = catalyst.userManagement;
var allUserPromise = userManagement.getAllProjectUsers();
allUserPromise
        .then((response) => {
            console.log(response.content);
        })
        .catch((err) => {
            console.log(err);
        });

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

Web SDK

Copied[
  {
    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: []
  }
]
Copied[
  {
    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: []
  }
]