0

Is there any way to check FLS for a field on a record that the user does not have object (sharing) access to?

Object access is specifically not granted for this object because the user should not be able to freely view/edit the record using the standard pages and Lightning Communities do not have a way to disable these for objects other than revoking object access. Even though I am not using sharing, FLS is still a very powerful tool for admins to be able to control which aspects of a record a certain user can view/edit. The built in FLS access checks on FieldDescribeResult will all report false because these take object access into account.

Is there any mechanism where I can check the actual FLS settings for the user at the Profile and/or Permission Set level, then manually report these back to the component to control rendering?

2

If a user has permissions to specific fields you can list down using following SOQL, which returns based on user profile and permission sets that user is assigned to.

SELECT Id, Field, SObjectType, PermissionsRead, PermissionsEdit 
FROM FieldPermissions 
WHERE SObjectType = 'Account'
AND Parentid IN 
(SELECT permissionsetid 
    FROM PermissionSetAssignment 
    WHERE Assignee.Id = :Userinfo.getUserId()) 

Results

Field Permissions

For more information, refer:

User, Sharing, and Permission Objects data model

and Using SOQL to Determine Your Force.com User’s Permissions

  • @dsharrison is that works for you? – Santanu Boral Aug 15 '17 at 17:34
  • For the most part yes, I am still working through some weird behavior I am getting with some setups. I'll accept this as the answer once I can get the remaining cases working. – dsharrison Aug 19 '17 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.