Private fields not shown to users with "View webform submissions for own node" permission

Created on 6 November 2022, over 1 year ago
Updated 2 June 2023, about 1 year ago

Problem/Motivation

There seems to be an issue with private file permissions when having webforms as node fields.

Steps to reproduce

I have:

  1. a webform, lets call it WFR1
  2. a private file field element as part of the WFR1's fields, let's call it PFF1
  3. a custom content type (let's call it CCT1) with a title field and a webform field
  4. a CCT1 node that uses WFR1, let's call the node NOD1
  5. a user role (let's call it UROL1) with: "View webform submissions for own node" enabled (/admin/people/permissions/urol1)
  6. a UROL1 user let's call him Patrick

And the issue:

  1. Patrick is the author of NOD1
  2. Patrick can access submissions that have been submitted in NOD1, but not the files uploaded in the private file field PFF1
  3. Patrick can only access the private file field PFF1 if I grant him the View any submissions permission in WFR1 (/admin/structure/webform/manage/wfr1/access)

This seems like a bug, I guess that Patrick should be able to access PFF1 without step 9, since step 9 gives him access to all submissions and not just the ones of NOD1.

Proposed resolution

  • Take the 'view webform submissions any node' and 'view webform submissions own node' permissions into account.
  • Allow private field access to be changed with the hook_webform_element_access() hook.

If both can be done, that's preferable. Or if not, then at least allow using the hook. One reason the hook should be usable is that it allows more flexibility in contrib/custom code.

🐛 Bug report
Status

Needs review

Version

6.2

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024