function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MDV SuryaMDV Surya 

Unable to access Apex Component from AngularJS

Hello everyone,
    
    Can anyone help on the below issue.
    
I am using visualforce with angularjs.
I have a visualforce page (Search) and two apex components (SimpleSearch and AdvancedSearch).
I am loading the apex components into the page through angularjs using routeprovider.
 
SearchApp.config(['$routeProvider', function($routeProvider) {
    $routeProvider
        .when('/', {templateUrl: '/apexcomponent/SimpleSearch', 
            controller: 'SimpleSearchCtrl'})
        .when('/advsrch', {templateUrl: sitePrefix+'/apexcomponent/AdvancedSearch', 
            controller: 'AdvancedSearchCtrl'})
        .otherwise({redirectTo: '/'});
}]);

It works when using Administator user (salesforce licence) because admin has "Customize Application" permission.
When using simple user (Other than salesforce licence e.g. salesforce platform licence) I am getting a 500 Internal server error in browser console for component.
In the error log we found the below message.
You do not have sufficient privileges to access the page: /apexcomponent/SimpleSearch httpReferer=https-//c-naNN-visual-force-com/apex/Search
Dileep KumarDileep Kumar

Hi MDV Surya,

Please give the permission of Apex Component,Object,field Class to that user.By which you want to access.

Thanks,

Dileep

MDV SuryaMDV Surya
Hi Dileep,
Thanks for your response, we have given access to object, fields, class and page, but for apex components not sure how to give access.
can you please let me know.
Dileep KumarDileep Kumar

Hi MDV Surya,

Please create Permission set and assign this set to that specific user.You can not give the permission of visualforce component directly.

If you will give permission for VF page and if this page having VF component then it will able to access directly that page.

 

Please read below message :

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.

 

If it will useful.please mark it as a answer.

Thanks,

Dileep Kumar

Sayeeda Banu 5Sayeeda Banu 5
I have created my lightning app using Angular Js. Now am planning to create One Component of this application using lightning Aura Component. I want to know how to call an Aura Component from Angular Js.
I already know that we can call aura Component using Visual Force page. Can You guys at least tell me how to call VF page from Angular Js Code?
My Code is like .when('/monitoring/jobDownload', {templateUrl: 'job', controller: ' controller'}) (this is just anexample code you can relate  with real code).
I need to know how to call a VF page in place of this template URL 


Please Help me.