1

After managed package is installed, post install script is executed under some virtual system user with God permissions. But there are some issues with this type of user when it comes to querying directly permission tables etc.

So we need a way to identify somehow in our business logic that it is this special package user executing logic from post install script context to react appropriately.

I've dumped UserInfo properties from post install script:

DEBUG: getName=MY_TEST_PACKAGE
DEBUG: getUserName=033f4000000xfuvaas@00dq0000000cbj6eag
DEBUG: getUserType=LicenseManager
DEBUG: getUserEmail=noreply@salesforce.com
DEBUG: getProfileId=00e41000001qaB4AAI
DEBUG: getSessionId=null
DEBUG: fetch user from db by id - users.size=0

Based on this it seems that the most reliable way would be to check if user with such id exists in User table - if no, than it's package user. Any better ideas? Is there more accurate way (prefereably without issuing separate query)?

2

Simply checking if getUserType = LicenseManager should be sufficient; there's no way for a real user to log in to a LicenseManager type, nor can you create users that have this user type.

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.