I have a permissionset which I want to grant broad read-only access to nearly all fields and objects. I've granted the permissionset the ViewAllData permission already, but that permission does not grant field-level security, only record-level security.
In order to ensure that developers don't forget to add Read permissions to new fields, there's a unit test which ensures this by leveraging Schema.getGlobalDescribe()
and a blocklist (SObjects like ApexTestResult
are excluded since I do NOT want to grant this user Customize Application
permissions).
All well and good - developers are fine with this, and so is the org. I even have a script that inserts/removes prod-only object permissions on the metadata file like NamespaceRegistry
depending on if I'm deploying to a sandbox.
However, we have several managed packages installed which may add fields to notable objects, and Salesforce adds new fields with each release. How can I deal with these? Can I keep my unit test functional and passing?