Problem/Motivation

It is difficult, currently, to hide a core field definition from a user and apply access controls as webform submissions bypass Drupal's usual field access hooks.

It would be a great feature to add a hook so that certain base definitions are able to be hidden in various contexts. The ones I see most relevant being:
- the results table
- wherever entities are printed (downloads etc)

Steps to reproduce

1. Try to hide remote IP conditionally from results table and entity print

Proposed resolution

Add in a hook in the checkFieldDefinitionAccess function to allow other modules to unset field definitions and remove them from display.

Remaining tasks

Add tests.

User interface changes

N/A

API changes

New hook: hook_webform_submission_field_definition_access_alter().
Ability to unset field definition keys and hide them from results tables/exports.

Data model changes

N/A

Issue fork webform-3534453

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

littlepixiez created an issue. See original summary.

littlepixiez’s picture

Assigned: littlepixiez » Unassigned
Status: Active » Needs review

I will need to add a test to this, but would love feedback on whether the webform community think this is a good idea and whether this hook should touch logic in the results table as well as in the original function.

littlepixiez’s picture

Also adding a patch here for Webform 6.2.x, as webform.api.php isn't using namespaced vars in that version.

jrockowitz’s picture

Any access control improvement will need some test coverage.

liam morland made their first commit to this issue’s fork.

jrockowitz’s picture

Status: Needs review » Closed (won't fix)

I think this is edge case feature that should be addressed in a dedicated contributed module. OOTB the Submission List builder can be replaced with views that hide default properties.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.