Newer Version Available
Comply with a User’s Personal Information Visibility Settings
Orgs with portals and sites provide specific settings to hide a user’s personally
identifiable and contact information from other users. These settings aren’t enforced in Apex,
even with Apex security features such as the WITH
SECURITY_ENFORCED clause or the stripInaccessible method. To hide specific fields from a guest or external
authenticated users, follow the sample code outlined below.
To hide a user’s personal information in the User object:
To comply with a user’s contact information visibility settings within a community or portal, we check the preferences associated with specific fields and show or hide the data accordingly. For a user’s contact visibility settings within an Experience Cloud site: