I have been searching for an answer for a while now and cant seem to find one. When logged in as an administrator with permissions set correctly I get an "Access Denied - You are not authorized to access this page." error whenever I try to view submissions, analysis, table, or download results. None of those will work for me. I have many installations of Drupal and one thing I notice is that my installations that also have the Domain Access module have this error. My sites without Domain Access seem to work fine. Any idea what I can do to fix this?

Comments

quicksketch’s picture

Category: bug » support
Priority: Major » Normal

This does not occur with normal installations of Webform, so I'm moving this to a support request.

I think you're right that the most likely source of the problem would be an access-control module, but I'm running Webform together with Domain Access just fine on one of my sites and I don't think they should conflict. Just checking, but are you really running the 3.4 version of the module? Could you try upgrading to the latest 3.x release for Drupal 6?

austinminn’s picture

Yes we have 3.4 on our live sites. I tried changing to the recommend version for Drupal 6 which is 3.18 on our test server and it still have the same problem. Does anyone have any suggestions or fixes? It would be much appreciated!

We are currently running Domain Access 2.11 (current recommend release is 2.13). Could that be the issue? We are actually running a very large database of over 100 sites with our install and Domain Access is the heart of it so it makes us very nervous to upgrade it.

quicksketch’s picture

Is the "Results" tab still displaying on individual Webform nodes? Or is that not display either? If it's a node access control module preventing access, you shouldn't see the "Results" tab at all. If you can see the tab (and the individual sub-tabs for Submissions, Analysis, etc) but you get access denied when viewing them, something is causing the problem a little closer to the surface.

austinminn’s picture

I'm not seeing a "Results" tab anywhere (we are using a special admin theme so that might be why I can't find it). I can see Submissions, Analysis, Table, and Download on the Webforms list page but all take me to an Access Denied page. I can view and edit the forms fine. The module will send submissions via email just fine as well. We just want to allow our offices to download results as well.

quicksketch’s picture

Hm, so sounds like a permissions problem indeed. You said you had the "permissions set correctly". But to check, have you granted users the "access all webform results" permission?

austinminn’s picture

Yes, I agree that it seems like a permission problem. I am logged in as an administrator and my administrator role has all permissions enabled for Webform. That should give my account access, right? I really don't understand why this error is occurring.

quicksketch’s picture

In order to debug this problem, I think you're going to have to do some test coding (or use a debugger). Are you comfortable with custom coding?

To test, I'd try the following:

- Install the devel module.
- Visit the /devel/php URL on your site.
- Paste in the following code and post your results here. Replace $nid = 1 so that "1" is the NID of a Webform that is not displaying the tab properly.

  $nid = 1;
  $node = node_load($nid);
  $account = $GLOBALS['user'];

  dvm("Node view access:");
  dvm(node_access('view', $node, $account));
  dvm("Webform access all results:");
  dvm(user_access('access all webform results', $account));
  foreach (module_implements('webform_results_access') as $module) {
    dvm($module . ' results access:');
    dvm(module_invoke($module, 'webform_results_access', $node, $account));
  }
austinminn’s picture

Below are the results I got. It looks kinda weird...

string(17) "Node view access:"
bool(true)
string(27) "Webform access all results:"
bool(true)

I did this on multiple Webforms and got this same thing. Does that tell you anything?

quicksketch’s picture

Hmm, well looks to me like you should have access to the results then and domain access isn't getting involved (otherwise "Node view access" would have been bool(false)). I'm generally out of ideas here. You should start working through the code in Webform starting with hook_menu() and going down into the code until something is returning access denied. Or alternatively make a backup of your database and code and try it out on a different server (such as your localhost) and turn off modules until access starts working again. Then once the culprit is found, start looking more into that particular module.

austinminn’s picture

Ok. Thanks a lot quicksketch! You were very helpful. We do have A LOT of modules installed so Domain Access not being the culprit could be very likely. We might try your second option on our test server that is already set up to see if we can find the rogue module. Thanks again!

quicksketch’s picture

Status: Active » Closed (fixed)

Closing after lack of activity. It'd be interesting to know what the culprit was for posterity if you get a chance.

knalstaaf’s picture

Issue summary: View changes

I'm having the same issue, but only for older webform-nodes. So my guess is that there must be a module which put a lock on the nodes created before it was enabled indeed. When I'm making a new webform-enabled node, every other user can access the webform results.

I could solve it for the older webform-nodes by checking Bypass content access control in the permissions overview (below "node").

I have four permission-related modules enabled (@austinminn: do you have one of them in common?)

I disabled (and de-installed) all four of them, cleared caches, ran cron - no result.

I'll check back if I have any more information.

knalstaaf’s picture

Version: 6.x-3.4 » 7.x-3.19
knalstaaf’s picture

Version: 7.x-3.19 » 7.x-3.20

(Upgraded to 7.x-3.20, no progress)

Seems like they had a similar issue at Drupal Gardens.

knalstaaf’s picture

I managed to restore a backup from the time these modules (#12) weren't in the game yet, and I couldn't access the webform results as an authorised user (<- not the admin) either.

My guess is this is either a legacy issue within Webform, or another module.

I'm leaving the status as "fixed" as there's a way around it described in #12, and I presume this will not occur with webform-enabled nodes created with recent Webform versions (> 7.x-3.19).

knalstaaf’s picture

Title: Access Denied when trying to download results » Access Denied when trying to view Webform results
Issue summary: View changes

Another small thing I'd like to point out: my case isn't totally similar with the starting post, as I can access the results of every Webform node as an administrator. It's any other role below it that experiences this issue.

boshtian’s picture

I have Domain Access and Webform, and as an administrator I can access submission, any other users can't.

I played around with permissions and figured out, that if I give the 'Administer domain records and settings' permission inside of Domain Access permissions I can access submissions.

As I suspected from the beginning, this is actually not a Webform issue, but rather Domain Access interfering somewhere. Of course I can't give that permission to the group of users that should access submission, but it is a starting point.

web506’s picture

Thanks Boshtian, it is a starting point, same as you over here. If you found out any other solution please advice, thanks!

tripper54’s picture

For anyone who like me found this issue using the google, let me share my problem and solution.

In my case, the site had 2 user roles that needed access to webform results: administrators, and another role called 'promotions'. There was no problem with administrators, but promotions uses could only access results on content they owned. This is even though they had the 'access all results' permission.

After experimenting a bit I discovered that promotions uses _could_ access any results, but only on nodes that were published. When I enabled the 'view_unpublished' module, gave promotions users permission to view unpublished nodes of the relevant type, and rebuilt permissions, the problem was solved.

It's interesting that you need to need permission to view a node to see/download results. It was kind of incongruous in my case that these users were able to edit a node, and edit a webform, but were unable to access results.

jaesperanza’s picture

In my case, the culprit was a URL change generated by the Redirect module. Forgot to change the link from where the webform is accessed. Clickable webform link is a popup window. Seems redirect URL will not work in the popup implemented. All else, e.g. menu link going to the webform works.

chipway’s picture

You can manage this issue with a custom module and coding your own access callback

function mymodule_menu_alter(&$items) {
$items['node/%webform_menu/submission/%webform_menu_submission']['access callback'] = 'mymodule_view_submissions';
$items['node/%webform_menu/submission/%webform_menu_submission']['access arguments'] = [1, 3, 'view'];
}

And setting your module weigth heigher than domain access.