matomo-org / tag-manager

Free Open Source Matomo Tag Manager - A simple way to manage and maintain all of your (third-party) tags on your website.
https://matomo.org
GNU General Public License v3.0
170 stars 58 forks source link

Hide publish button for users with no tagmanager_use_custom_templates capability #784

Closed 9joshua closed 4 months ago

9joshua commented 5 months ago

A customer reported that when they publish a container with only MTM Write capability the resulting version is empty with all Tags, Triggers and Variables deleted.

I tested this on my own instance by doing the following:

  1. Create a User with Write permission to the Site ID - This will provide Tag Manager Write capability.
  2. Edit a Trigger in the container
  3. Publish a new versions
  4. Inspect the versions history and export the JSON file for the version...
{"idcontainer":"jgh7DXLd","idsite":5,"context":"web","name":"Default Container","description":"This container was auto generated when the website was created.","ignoreGtmDataLayer":0,"created_date":"2023-03-03 03:11:16","updated_date":"2024-04-11 21:02:51","created_date_pretty":"Mar 3, 2023 16:11:16","updated_date_pretty":"Apr 12, 2024 09:02:51","revision":129,"version":{"name":"225","description":"","revision":129,"created_date":"2024-04-30 03:32:23","created_date_pretty":"Apr 30, 2024 15:32:23","updated_date":"2024-04-30 03:32:23","updated_date_pretty":"Apr 30, 2024 15:32:23"},"tags":[],"triggers":[],"variables":[]}

image

It's worth noting that this issue did not occur when the same User was given "Use Custom Templates" MTM capability.

AltamashShaikh commented 5 months ago

@9joshua I have found the problem, along with write permission, tagmanager_use_custom_templates capability is required

Screenshot from 2024-04-30 12-02-07

We should ideally hide the publish button if that capability is not present.

atom-box commented 1 week ago

Keep this closed. Just noting that a newer issue, related to this is here: https://github.com/matomo-org/tag-manager/issues/893