Find your content:

Search form

You are here

calling an actionfunction reloads the page despite giving rerender attribute and says insufficient privileges in sites?


Calling an actionfunction reloads the page despite:

  1. return false from the place where we call

  2. setting rerender="emptydiv"

It says insufficient privileges in Sites (authenticated using partner portal).. but if we refresh the page again or reload by pressing enter in the url again, its not throwing that insufficient privileges error..

any ideas or suggestions to solve this problem would be much appreciated...

updated :- I have given access to all the objects and classes. when I try to preview as admin, I got this error. "Access to entity 'StaticResource' denied"

Am accessing this in my code. Not sure how to give access to this StaticResource Object for my Partner Portal User Profile.I dont find this object in the profile. Can you please help?

List<StaticResource> resourceList = [SELECT Name, NamespacePrefix, SystemModStamp 
        FROM StaticResource WHERE Name = 'MyStyles'];

This is my scenario :- I have a JQGrid. inside that I have a column in which I have a link (a tag).
Am populating data for the JQGrid from from the controller.
The method is hit as I have specified the URL parameter of JQGrid.

So whenever the pageload or any operation in the grid happens and tries to reload the grid, it hits the url and based on the JSON returned, the grid is populated.

Inside the grid, I have to show some images. for doing that am getting the images through the above code and assigning it to a property for displaying in the grid. The GetresourceURL function in the below code pulls the data from the list fetched in above code and checks what type of image is needed and does some manipulations and gives the actual resource url for the image.

I have just pasted the smaller version of the GetResourceURL code for your easy understanding.

Actually the thing here is, when i click on the application link it should log an entry in a tracking object (just to note that the user has clicked the link and its used for reporting purposes later). for this reason am doing an onclick javascript and from this am calling an actionfunction which does the job of logging in to necessary object and opens the target link in a new tab.

actually it logs the data and it tries to reload the page. not sure why it does that.. the same page is not reloaded.

if i run the visualforce page as a system administrator, but when viewing from sites url as an external customer this "Insufficient privileges" error is thrown.

So, first time the page is getting loaded. When i click on this link the page is performing actionfunction when viewed from sites, and reloading the page (which shouldnt actually reload). If it is an insufficient access for static resource how is it able to access for the first time load?

asset.ApplicationNumber = (currentAsset.Country__c == 'US' 
        && currentAsset.URL__c != null
        && !currentAsset.URL__c.contains('patentnumber'))
    ? string.format(
        '<a style="color:#0073A3;text-decoration: none; !important; cursor:pointer;" onclick="FetchDataForPatent({2},{3},{4},{5});">{1}</a>',
        new String[] {
            '\'' + currentAsset.ApplicationNumber__c + '\'',
            '\'' + currentAsset.URL__c + '\'',
            '\'' + currentAsset.Id + '\'',
            '\'' + CompanyID + '\''
    : currentAsset.ApplicationNumber__c;

currentDoc.DocumentTitle__c= string.format(
    '<a style="color:#0073A3; cursor:pointer"  onclick="return FetchDataForDoc({0},{1},{2},{4},{5},{6},{7})">{3}</a>',
    new String[] {
        '\'' + currentDoc.Id + '\'',
        '\'' + UserType + '\'',
        (GetResourceURL(resourceList, currentDoc.FileType)!='')
            ? ('<img src='+GetResourceURL(resourceList, currentDoc.FileType)
               + '> '+ currentDoc.DocumentTitle__c)
            : currentDoc.DocumentTitle__c,
        '\'' + docInfo.DocTitleWithoutImage + '\'',
        '\'' + CompanyID + '\'',
        '\'' + currentDoc.FileName__c + '\'',
        '\'' + BaseURL + '\''

    return ((Site.getPrefix() != null) ? Site.getCurrentSiteUrl() : '') 
        + '/resource/'
        + resourceLst[0].SystemModStamp.getTime() 
        + '/' 
        + (namespace != null && namespace != '' ? namespace + '__' : '') 
        + 'MyStyles' + '/CSS/Images/' + imageName;

When I use chrome developer tools to see whats happening. I am seeing an internal server error 500 :-
This error is thrown :-

        LOG.warn("request stopped due to timeout");

Images below:

image 1

image 2

Attribution to: Sathya

Possible Suggestion/Solution #1

Regarding the StaticResource update, if I recall correctly, the StaticResource's cache control must be set to public when using w/ public facing sites. I've never seen Apex used to access the StaticResource, only VF though, so I'm not sure how the permissions relate in SOQL.

Also, VF is case sensitive w/ the rerender attribute, so make sure your rerender attribute is the same case / spelling as the id of the element you'd like to rerender. If that's not the case, then your page will reload entirely.

Attribution to: James Loghry

Possible Suggestion/Solution #2

The insufficient privs in Sites could refer to any point in the controller logic trying to do something that the Partner Portal would not be able to access. It also might come as the result of a Visualforce error in general.

What is the behavior of the page when not being accessed by a Portal user or Sites Guest User?

Attribution to: joshbirk

Possible Suggestion/Solution #3

Following existing advice here, making sure that an error is not to blame, see that the Apex controller class has been included in your site's approved components:

Public Access Settings | Apex Classes | Edit

Regardless of whether your actionFunction is calling a method that does nothing but return a value, that's when your controller is invoked. To prove this, simply remove the action portion of your actionFunction, like this:

<apex:actionFunction name="test" reRender="emptydiv">

Additionally, remember that you can't re-render a non-Visualforce component, such as a div. If you're trying to re-render a div, wrap the section in an outputPanel instead:

<apex:outputPanel id="emptyoutpan">

Finally, a good practice to avoid hitting your head against the wall with sites is to create a custom tab and verify your work from there as well. Then when you hit errors you will see what errors are actually being thrown, rather than simply seeing an authentication page.

Attribution to: Adam
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content