5

I'm wondering how to implement user restrictions to an SFDC AppExchange App based on Licenses with the LMA. The idea is that only users within a customer's org who have been assigned a license have access to the app.

Our app is already developed, but currently, everyone in the installed org has access to it and can use it. Its mainly visualforce pages and controllers. In order to publish the app as a paid app with the LMA, will extra development need to be done to handle restricting access to the app based on who has licenses?

Is there documentation on this?

5

Generally speaking, there's nothing "special" you need to do (in most cases). Once you switch to a per-license model, salesforce will automatically restrict access to all components in your package unless the logged in user has a license assigned, even if they have permission at the profile/permission set level. From their perspective, they won't even know the package is installed short of looking at Setup > Installed Packages.

The only exception you need to make is if you have triggers or other logic that they would have access to indirectly that should only function for licensed users. In that case, you can use UserInfo.isCurrentUserLicensed(namespace) to determine if the user has a license assigned to that package. I haven't worked on a lot of packages, but I've yet to actually need this feature.

  • How does a developer switch an app to a per-license model? – Tyler Zika Nov 8 '16 at 18:13
  • @TylerZika You don't set it in the app, you specify it by License record. See the LMA documentation. Basically, there's a checkbox for Site license, and a number field for the number of licenses to assign. You can edit the License record to directly affect the number of licenses, Site-wide status, trial mode, expiration date, etc. – sfdcfox Nov 8 '16 at 18:25

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.