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
ying liuying liu 

profile permission for webservice method

I hava a global class:
global class Test
{
    webservice static void send(Id eventId)    
    { 
    }
}

I want to call this webserive method from custom button. Javascript in this button:

{!REQUIRESCRIPT("/soap/ajax/18.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/18.0/apex.js")} 

var eventId = '{!Event__c.Id}'; 
sforce.apex.execute("Test", "send", {eventId : eventId}); 
window.location.reload();

Two users:
1. user:TestAdmin;profile:AdminProfile(salesforce license)
2. user:TestUser;profile:CustomerProfile(salesforce platform license) 
Both of two profiles have no access to this global class(Test).

TestAdmin can use the button normally but TestUser cannot use this button which will show error message:​
{faultcode:'sf:INSUFFICIENT_ACCESS', faultstring:'Test: no access allowed to this class.', }

I cannot find the reason and I want to know if there are any setting for profile to access webservice method without class permission?
Thanks in advance.
Best Answer chosen by ying liu
BalajiRanganathanBalajiRanganathan
If users have the “Author Apex” permission, they can access all Apex classes in the associated organization, regardless of the security setting for individual classes

https://help.salesforce.com/HTViewHelpDoc?id=code_package_security.htm&language=en_US

All Answers

BalajiRanganathanBalajiRanganathan
did you check your Security of the Test Class? System Administrator profile might have been added by default
ying liuying liu
Thanks for your reply.
My AdminProfile is copied from System Administrator profile.
And I have checked the security of the Test Class there is no my AdminProfile there.
BalajiRanganathanBalajiRanganathan
If users have the “Author Apex” permission, they can access all Apex classes in the associated organization, regardless of the security setting for individual classes

https://help.salesforce.com/HTViewHelpDoc?id=code_package_security.htm&language=en_US
This was selected as the best answer