Problem/Motivation

Current Webform version (8.x-5.1) provides "View any webform submissions" permission that can be granted to any roles, users or permissions.

On our website, users have access to creating webforms and managing submissions from their webforms.

The problem is that webform "Authored by>Alex" is not able to see submissions made by anonymous users,
to see anonymous results "Alex" should set his username to "Access>View any submissions>Users" or "Administer webform & submissions".

If the owners of the webforms do not know that, they will never see submissions made by anonymous users in their created webforms.

Proposed resolution

in "WebformSubmissionAccessControlHandler.php"
we may need to add additional check to "public function checkAccess" if webform authored by current user "return WebformAccessResult::allowed();"

or we can set automatically "Authored by" username to "Access>View any submissions>Users"?

Best Regards,
Alex Dureaghin

Comments

dureaghin created an issue. See original summary.

jrockowitz’s picture

Category: Feature request » Bug report
Priority: Normal » Major

Below are my steps to reproduce this issue.

  • Create 'test' role with 'Access the webform overview page', 'Create webforms', and 'Edit own webform'
  • Create 'test' user assigned to 'test' role.
  • Login as 'test' user.
  • Go to Webforms (/admin/structure/webform)
  • Add webform
  • Add submisison to new webform
  • Confirm that test user can't view any submissions.

I agree that a user who can update a webform should be able to access all the webform's submissions.

jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new970 bytes

#3006765: Webform submission entity access is not enforced in view query is blocking webform owners from seeing all the submissions.

The attached patch fixes the issue but does have some performance implications because it requires every single webform to be loaded and have its 'update' access checked. I think we can cache this information per the user's session.

dureaghin’s picture

Hi Jacob,
Thank you very much for your quick reply. I will try to check your patch tonight.

Regarding comment from your patch.
// @todo Determine how to cache user specific webform access.

Here is an example of how to cache a user access cache:
MediaAccessControlHandler.php

I will try to find time to create a patch for this.

Thanks Again!

Alex.

dureaghin’s picture

StatusFileSize
new107.01 KB
new15.74 KB

Hi Jacob,

I think that the attached patch does not work properly, if the webform owner has access to "Edit own webform", he should be able to edit any submissions from his created webforms.

Please see attached screenshots.

Thank you,
Alex.

jrockowitz’s picture

Status: Needs review » Needs work
jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new1.61 KB

Please test the attached patch which still requires test coverage and a change record.

dureaghin’s picture

StatusFileSize
new149.03 KB

Works! Now the webform owners can view and edit any submissions from their webforms.

Please see attached screenshot.

Thanks,
Alex.

jrockowitz’s picture

StatusFileSize
new6.06 KB

The attached patch includes test coverage.

dureaghin’s picture

This patch #9 works for me. This issue can be considered as resolved.

Thank you!

jrockowitz’s picture

Status: Needs review » Fixed

I committed the patch. Please download the latest dev release to review.

  • jrockowitz committed fca552b on 8.x-5.x
    Issue #3034408 by jrockowitz, dureaghin: Access to view any submissions...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.