Problem/Motivation

Revisions tab is shown up when the anonymous user accesses the Webforms. The anonymous user should not see the "Revisions" and "View" Tabs.

Steps to reproduce

Drupal Environment:
Drupal Core 9.4.7
PHP 8.0

1) Installed and enabled the Config Revision (1.0.0-alpha3).
2) Applied Config Revision patch (#2350939-202) or (2350939-254): Implement a generic revision UI.
3) Enable "Webform" in Config Revision Settings (/admin/config/development/config-revision)
4) Installed and enabled Webform Revision UI module

As a result, Revisions and View Tabs are shown up when the anonymous user accesses the Webforms.

I have temporarily used CSS to hide the tabs from the anonymous user.

body.anonymous.path-webform ul.tabs--primary.nav.nav-tabs {
display: none;
}

Revisions tab issue

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

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

jamesyao created an issue. See original summary.

jamesyao’s picture

Version: 1.0.x-dev » 1.0.0-alpha2

mohit_aghera made their first commit to this issue’s fork.

mohit_aghera’s picture

Status: Active » Needs review

Added permission so that tab is not visible to anonymous users.

jamesyao’s picture

Thanks @mohit_aghera. Adding routing permission works to me.

joseph.olstad’s picture

Status: Needs review » Reviewed & tested by the community

RTBC
Test failure is unrelated to this functionality.

jamesyao’s picture

Could someone please approve @mohit_aghera's merge request about adding permission?

jibran’s picture

Can we make the tests green?

joseph.olstad’s picture

@jibran,

I've linked the two related issues. Meanwhile the merge request is still good!

joseph.olstad’s picture

joseph.olstad’s picture

@jibran, please trigger D9.5.x tests with a supported version of PHP

joseph.olstad’s picture

Proof that the test fails have nothing to do with the above merge request:

I created a patch to add a README.md, the automated test failed

see results here: the no change patch is the second one from comment #4

I discovered the drupalci.yml was trying to apply a patch that's already been committed to the latest Drupal. A rerolled patch is required for tests to pass with Drupal 9.5.x, I'm testing a possible fix now

#3336449-4: Fix webform_revision_ui HEAD tests

jamesyao’s picture

Thanks @joseph.olstad for providing the root of the automation test failure cause about the merge request.

joseph.olstad’s picture

I am stumped why the fails in config_revision and webform_revsion_ui , I necessarily updated the patch for the drupalci.yml to the expected patch but there's still errors. I'd appreciate it if someone else had a look at the config_revision issue

#3145075: Fix HEAD tests for config_revision for D9.5

joseph.olstad’s picture

Patch 3328890 from the merge request is still good! Holding status as RTBC

Thanks

progga made their first commit to this issue’s fork.

progga’s picture

Status: Reviewed & tested by the community » Needs review

Hello,
I am proposing an alternate fix where anybody who has the "view all webform revisions" permission would see its "Revisions" tab.

Change summary:
- New user permissions: view all webform revisions, revert all webform revisions, delete all webform revisions. These permissions provide fine grained access control over Webform revisions compared to the catch all "administer config_revision" permission. An update hook applies these permissions to all roles with the "administer config_revision" permission. This should make code update easier.
- Permission fix for the "Revisions" tab. Associated functional test method.
- Had to add a Gitlab CI file as DrupalCI isn't running for some reason. Gitlab CI test is passing thankfully.
- Gitlab CI seems to require a composer.json file to grab dependencies. So had to add one.
- Some small fixes to cope with coding standard and static analysis checks.

Please note that, with this change, just because someone has access to the revision history doesn't mean they could revert them. Please let me know if this approach is acceptable. Thanks.

joseph.olstad’s picture

Status: Needs review » Postponed
Related issues: +#3435672: Automated Drupal 11 compatibility fixes for webform_revision_ui

I've put this fix into the Drupal 11 compatibility MR and credited those above in the commit.

joseph.olstad’s picture

This is almost ready to go in for the Drupal 11 upgrade except the maintainer has asked for additional tests to be written covering operations based on the given permission.

#3435672: Automated Drupal 11 compatibility fixes for webform_revision_ui

So, needs more tests.

joseph.olstad’s picture

Status: Postponed » Needs work

please add the tests to the MR in #3435672-22: Automated Drupal 11 compatibility fixes for webform_revision_ui

we also need to test per permission and make sure all the operations are supported by newly added permissions.

jibran’s picture

Status: Needs work » Closed (duplicate)