Find your content:

Search form

You are here

ActionFunction on a Sites page with a guest login

 
Share

I have two very similar VF components with actionFunctions in them. Thee components are conditionally rendered using a formula to see if the user is logged in and are not shown if the user is a guest. When I use an actionFunction in one of the components it works fine. When I add it to the other component and try to view the page as a guest I get the 'down for maintenance page'. From the debug log it looks like it's triggering the Unauthorized page, but it's unclear why.

I realize this is kind of vague, but I'm wondering if there are there some permissions issues here with actionFunctions that I'm not seeing.


Attribution to: paul

Possible Suggestion/Solution #1

Does the Guest User (and potentially the Site ?) have access to both Pages (VF Pages in each of the components) ?


Attribution to: techtrekker

Possible Suggestion/Solution #2

When ever there is an error in the controller or the page the site shows unauthorised page .In the site settings you may check that the what are the page assignments .

Site settings>Error Pages and find if everything is assigned properly or not .


Attribution to: Mohith Shrivastava

Possible Suggestion/Solution #3

Does the Guest profile have access to everything that the component and/or component's controller uses? You need to make sure that the Guest profile has the proper object CRUD and FLS. You get to the Guest profile by going through the Site settings and clicking the Public Access Settings button. The profile is NOT listed in the regular profile list.

So, while you may have given proper access to the VF pages and the Apex classes on the Site settings page, you still have to give the proper object permissions on the profile, itself.

As for why you get the site maintenance as opposed to the unauthorized, I believe that I've gotten the site maintenance before when my custom unauthorized page used something that the public profile didn't have access to or when that page had an error of some sort.


Attribution to: Peter Knolle

Possible Suggestion/Solution #4

I was working on someone else's code when this bug came up - didn't realize that in the constructor for the controller of a component on the VF page, the previous coder wrote this:

if (user.usertype == 'GUEST') {
            throw new NoAccessException();
}

The component should not have been loaded in the first place, because the render condition is:

rendered="{!NOT(ISPICKVAL($User.UserType,'Guest'))}

Which is why it was hard to find & debug, because I assumed it couldn't get there.

But for some reason, when an actionFunction is inserted into the component, it bypasses the render condition and loads the component and controller, triggering this error. I'm still not sure why it's only triggered when an actionFunction is added to the component, but commenting out that line throwing the exception solves the problem.

This might be related - http://boards.developerforce.com/t5/General-Development/System-Exception-Internal-Salesforce-com-Query-Error-Diagnosis/td-p/156459

I think it's a bug in the Salesforce code, maybe specific to Sites -- I'm going to email them and see if I get a response.

Thanks for your answers!


Attribution to: paul

Possible Suggestion/Solution #5

I had a similar problem and symptom where it would work internally (normal salesforce user), but not on sites as a guest user. After trying a combinations of items, wrapping the actionfunction with actionregion worked.


Attribution to: Jeff
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/1965

My Block Status

My Block Content