We are using an appexchange app that consists of a visualforce inline page. This visualforce page connects to a third-party API and displays some information on a record detail page. The licensing for this app is not done through the appexchange, but through the third-party API. So this app is deployed to all users although most of them will not get any functionality from it.
We have licenses for just a fraction of our users. All licensed users share the same profile. Currently all users that share that profile will see the visualforce page on the page layout, but the licensed users will see the information as intended, and unlicensed users will see a message that they need to request a license. This is obviously not going to work because everyone wants a license to this app.
Please assume that creating new profiles and page layouts for the licensed users is not an option. It will create too many headaches going forward from a maintenance perspective.
We have somewhat resolved this by removing access to all fields, visualforce, and apex belonging to this app from all profiles. Then we can add those permissions using permission sets for users that have a license to the app. Now when an unlicensed user views the page, in place of the VF page, they will see a message that says 'Content cannot be displayed: You do not have sufficient privileges to access the page: '.
This solution is almost works for us, but we would like to be able to customize that message. However, this is a standard salesforce message indicating that the user does not have permissions to view the page, so I do not believe it can be customized.
Any solution that would allow us to customize that message or better yet - completely hide the VF page or page layout section from all users would be suitable.