function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ganesh Babu 8Ganesh Babu 8 

Differentiate salesforce user and contact user

Hi,

We have built a community portal with lightning components, we have a requirement like Internal users/system admin should login as other portal user and view their details. we have to restrict few pages in community based on logged in user.

Is there any option to find the logged in user is a contact or Internal user/system admin in community?

 Please help.

- Ganesh
@Karanraj@Karanraj
Using userType field you can able to identify the type of logged in user

The category of user license. Each UserType is associated with one or more UserLicense records. Each UserLicense is associated with one or more profiles. In API version 10.0 and later, valid values include:

Standard: user license. This user type also includesSalesforce Platform and Salesforce Platform One user licenses. Label is Standard.
PowerPartner: User whose access is limited because he or she is a partner and typically accesses the application through a partner portal or community. Label is Partner.
CSPLitePortal: user whose access is limited because he or she is an organization's customer and accesses the application through aCustomer Portal or community. Label is High Volume Portal.
CustomerSuccess: user whose access is limited because he or she is an organization's customer and accesses the application through a Customer Portal. Label is Customer Portal User.
PowerCustomerSuccess: user whose access is limited because he or she is an organization's customer and accesses the application through a Customer Portal. Label is Customer Portal Manager.

Users with this license type can view and edit data they directly own or data owned by or shared with users below them in the Customer Portal role hierarchy.

CsnOnly: user whose access to the application is limited to Chatter. This user type includes Chatter Free andChatter moderator users. Label is Chatter Free.
Ganesh Babu 8Ganesh Babu 8
Hi Karanraj,

Thanks for your reply. My question was little different. If am a system admin, I am trying to login community as another user (portal user) via contact. Can I able to identify the logged in user is real contact user or system admin in community?

-Ganesh