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 get_current_user() method fetches the details of the current user accessing the application and on whose scope the function is being executed. The authentication_service reference used below is already defined in the component instance page.
copy#Get details of user current_user = authentication_service.get_current_user()
A sample response is shown below :
copy{ zuid: "1005641433", zaaid: "1005641434", org_id: "1005641434", status: "ACTIVE", is_confirmed: false, email_id: "amelia.burrows@zylker.com", first_name: "Amelia", last_name: "Burrows", 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 userID of the user to the get_user_details() method. The response returns the details of the particular user, such as their lastname, the list of the roles the user holds, the type of the user, the orgID of the organization the user belongs to, their email address, and more. The authentication_service reference used below is already defined in the component instance page.
copy#Get details by userid user_details=authentication_service.get_user_details('12345')
A sample response is shown below :
copy{ zuid: "1005665160", zaaid: "1005665245", org_id: "1005665245", status: "ACTIVE", is_confirmed: false, email_id: "mikerogers@zylker.com ", first_name: "Michael", 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 get_all_users() method can fetch the details of all the users of all organizations.
The response returns the following details of all the users : lastname, the list of the roles, the type of the user, email address, userID, zuid, time zone, and more. The authentication_service reference used below is already defined in the component instance page.
copy#Get details of all users user_details = authentication_service.get_all_users()
A sample response is shown below :
copy[{ zuid: "1005648252", zaaid: "1005648253", org_id: "1005648253", status: "ACTIVE", is_confirmed: false, email_id: "p.boyle@zylker.com", first_name: "Parker", 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 ", first_name: "Robert", 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: [] } ]
Get Details of All Users in an org
The org_id is passed as a parameter to the get_all_users() method in order to fetch the users belonging to a particular organization. The authentication_service reference used below is already defined in the component instance page.
copy#Get details of all users user_details = authentication_service.get_all_users(org_id='1234')
A sample response is shown below :
copy[{ zuid: "1005648252", zaaid: "1005648253", org_id: "1005648253", status: "ACTIVE", is_confirmed: false, email_id: "roger.p@zylker.com", first_name: "Roger", last_name: "Parkinson", 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: [] } ]
Last Updated 2023-12-18 16:20:08 +0530 +0530
Yes
No
Send your feedback to us