I recently run into a problem when I try to check fls within an without sharing class.
Here is what I did:
For the user profile I set CustomObject__c
allow delete permission to "False"
public without sharing class TestSharing {
public static String TestAccess() {
CustomObject__c c = new CustomObject__c();
c.CustomField__c = 'abc';
insert c;
Schema.DescribeSObjectResult d = c.getSObjectType().getDescribe();
System.assertEquals(d.isDeletable(),true);
return null;
}
}
I am wondering what should d.isDeletable()
return if I am running TestSharing.TestAccess()
?
I was expecting it to return true (ignoring profile settings), because TestSharing is a without sharing class. However, it seems the value is always false disregarding the class sharing type.