[SalesForce] How to give access to a Visualforce Component to a profile

I want to give access to a Visualforce Component to a profile. I know I can give access to Apex Classes and Visualforce Pages under "Users -> Profiles -> [Profile Name]" as explained here.

However, I do not see any of our Visualforce Components there and I think the profile does not have access to that component. How can I do that?

Best Answer

The VisualForce Components inherit their security from the VisualForce Pages that they are called from, so it is not possible to set the security on one separately from the pages.

The Salesforce documentation is not that clear on this but it is implied in this section:

You can specify which users can execute a particular Visualforce page based on their profile or an associated permission set. Permission for a Visualforce page is checked at the top level only. Once users can access a page, they can execute all Apex that’s associated with the page. This includes:

The controller for the page and any Apex classes called from the controller class.

Any extension classes for the page and any Apex called from an extension.

Any Apex classes associated with custom components within the page. Any classes associated with the page through the use of apex:include or apex:composition.

For example, if page A depends on a controller that calls an Apex class B, and a user has access only to page A but not class B, the user can still execute the code in page A. Likewise, if a Visualforce page uses a custom component with an associated controller, security is only checked for the controller associated with the page, not for the controller associated with the component.

Related Topic