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
chaithaly gowdachaithaly gowda 

Security enforced on SOQL

Hi

I have applied stripInaccessible in the following query,
SObjectAccessDecision securityDecision = Security.stripInaccessible(AccessType.READABLE,[SELECT Id, Name, IsActive, , ProfileId, UserRoleId,UserRole.Name, Profile.Name, 
            FROM User WHERE Id =: pUserId LIMIT 1]);
            System.debug('Fields removed by stripInaccessible: '+securityDecision.getRemovedFields());
            
In the debug statement I can see Profile.Name and ProfileId are getting stripped. I am not sure check/give the permission to 'Profile Object /Fields. I dont find 'Set FLS ' in fields as well.

Any help is appreciated.

Thanks
.
SwethaSwetha (Salesforce Developers) 
HI chaithaly ,
I ran the same in my org as a System Admin and the debug does not show anything.
Can you clarify if you are running as admin in your org?

Checked related: https://newstechnologystuff.com/2020/04/08/enforce-security-with-the-stripinaccessible-method/

https://www.apexhours.com/security-in-salesforce/

Thanks