Problem/Motivation

Currently the google_tag.settings change when a new role is inserted even though the module's configuration has not changed. This is due to the configuration saving all available roles, rather than only the configured roles.

Proposed resolution

Only save the configured roles in google_tag.settings.role_list, so the module's configuration is unchanged when a new user role is added.

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

None.

API changes

None.

Data model changes

google_tag.settings.role_list now only saves configured roles.

Release notes snippet

google_tag.settings.role_list now only saves configured roles.

Comments

idebr created an issue. See original summary.

idebr’s picture

Status: Active » Needs review
StatusFileSize
new2.29 KB

Attached patch only saves the configured roles in google_tag.settings.role_list, so the module's configuration is unchanged when a new user role is added.

Before:

container_id: GTM-XXXXXXX
path_toggle: 'exclude listed'
path_list: "/admin*\n/batch*\n/node/add*\n/node/*/edit\n/node/*/delete\n/user/*/edit*\n/user/*/cancel*"
role_toggle: 'exclude listed'
role_list:
  anonymous: '0'
  authenticated: '0'
  administrator: '0'
...

After:

container_id: GTM-XXXXXXX
path_toggle: 'exclude listed'
path_list: "/admin*\n/batch*\n/node/add*\n/node/*/edit\n/node/*/delete\n/user/*/edit*\n/user/*/cancel*"
role_toggle: 'exclude listed'
role_list: {  }
...

  • solotandem committed d47ef76 on 8.x-1.x
    Issue #3016645 by idebr, solotandem: Only save configured roles in...
solotandem’s picture

Assigned: Unassigned » solotandem
Status: Needs review » Fixed

Good suggestion.

The patch omits hook_update_N as:
- the [exported] config will change one time regardless
- so that doing so in update hook is not necessary
- the filter of values is not mission critical to the other code

The patch retains array_filter() in _google_tag_role_check() to retain the array keys.

If you disagree with the changes please comment.

  • solotandem committed 418a34f on 8.x-1.x
    Issue #3016645 by idebr, solotandem: Only save configured roles in...

Status: Fixed » Closed (fixed)

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