3

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: [email protected]
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)?

1
  • How did you print these values? I have already tried writing a record to an object which is working, is there any other way like debug logs by configuring something? Commented Mar 1, 2022 at 13:22

1 Answer 1

3

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .