New events and actions to get/set webform access group membership

Created on 24 August 2023, about 1 year ago
Updated 25 July 2024, about 1 month ago

Problem/Motivation

It is not possible to get the membership (user ids) of Webform access groups (/admin/structure/webform/access/group/manage).

It would be useful to be able to add and remove members based on various conditions - ECA would be perfect for this! The Webform access groups are very powerful, but unfortunately there is no way to dynamically assign permissions using a low-code approach at the moment.

Also, there does not seem to be an event relating to modifying or creating a Webform access group. The "Update Content Entity" event does not seem to capture the Webform access group events as one might expect (given that they are technically content).

Steps to reproduce

Steps demonstrating that it is not possible to react to a Webform Access group being updated.

  • Add an "Update Content Entity" event to a new ECA model
  • Add a "Display Message" action and add a static message in the Message field
  • Create a new "Webform Access Group type", then a "Webform Access Group" (from the following url:/admin/structure/webform/access/group/manage)
  • Update the newly created group and click "Save"
  • The test message from the ECA model should appear (since a content entity was updated), but it does not.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Postponed: needs info

Version

1.0

Component

Code

Created by

🇨🇦Canada joelseguin Ontario, Canada

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

Comments & Activities

  • Issue created by @joelseguin
  • 🇨🇦Canada joelseguin Ontario, Canada
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Sorry @joelseguin for my late response, I've missed this issue somehow.

    The reason for the model not working as expected is that webform access groups are not content entities, but config entities. Therefore, you should be more successful with the Save config event.

  • 🇨🇦Canada joelseguin Ontario, Canada

    No problem, will test that out and report back.

  • 🇨🇦Canada joelseguin Ontario, Canada

    The "save config" event definitely works nicely with any webform access configuration that has changed - thanks!

    However, it seems that the actual users that are added to a Webform Access Group are not saved as config and are not accessible for that reason. Here is an example of a Webform Access Group config. Note that user ids are not stored within config (which completely makes sense):

    uuid: ba4ca60a-c97a-48c9-875e-8f05cee3efa7
    langcode: en
    status: true
    dependencies: { }
    id: south_region
    label: 'South Region'
    description: ''
    type: regions
    permissions:
    - create
    - configuration
    emails: { }

    Any thoughts as to how we could access the IDs of users that have been updated? Ultimately, the idea would be to be able to programmatically (via ECA) add/update user IDs based on logic.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    We need to find out, how that module stores that data. When we know that, we can build the process.

  • Status changed to Postponed: needs info 3 months ago
  • 🇩🇪Germany jurgenhaas Gottmadingen
  • Hello. The Webform Access Group seems to be "config" and it stores its data in a YML file. However, the Webform Access Group membership seems to be "content" and stores its data in the database table webform_access_group_user.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    With ECA we can access config entities and content entities. That means, for the webform access group, ECA can do something with the data. But for Webform Access Group Membership ECA can't as the table structure doesn't appear to be a content entity, it looks more like an arbitrary database table. For that, a specific action plugin would be required to work with that.

Production build 0.71.5 2024