I'm working on a managed package that inserts certain standard objects on package install via the post install handler (accounts, contacts, etc), and my goal is that these objects will be deleted if the user decides at some point to uninstall the package.
This is simple enough to accomplish via the post uninstall handler. However, to post this package on the exchange SFDC requires through their security check that CRUD and FLS is manually enforced, which means I am required to essentially add the below if statement, as an example:
if (Account.sObjectType.getDescribe().isDeletable()) delete accounts;
BUT, apparently the special user that creates and deletes the data (which is simply given the name of the package) apparently doesn't have delete access, as evidenced by the fact that adding this if statement prevents the delete from occurring on uninstall (alternatively, adding the keywords 'with sharing' to the class header likewise produces this same result). Apparently this special user does however have create access, as evidenced by the initial inserts going through after having performed the isCreateable() check in the install handler. It seems difficult to find any information on what kind of access this special user has and why.
Can anyone help shed light on why this is happening and how I might overcome it?