Non-admins cannot access the statistics - Permissions are broken

Created on 22 January 2020, over 5 years ago
Updated 7 May 2024, about 1 year ago

Problem/Motivation

While setting the module up I noticed, that only admins can visit the Google Analytics page provided by the module. The reason is, that the permissions seemed to have not been configured properly.

1. In ga_node_reports.permissions.yml file the permission key is called administer ga node reports config
There is no configuration page for the module, so that permission is wrongly named.

2. In ga_node_reports.links.task.yml this permission was used. So the tab will appear for all users with the permission.

3. In ga_node_reports.routing.yml the required permission is called View Google analytics node reports.
Permissions need to be defined by its key, not its description. This means non-admins haven't been able to visit that page. User 1 only, because they are bypassing the access check.

Proposed resolution

I would propose to rename the whole permission to view ga node reports to make its purpose clear. Then changing the different yml files to use this permission. This is the cleanest solution, because we don't have an admin configuration page for the module, but might get this in the future.

I'm not sure if we need an update hook for updating the role permissions, because as far as I can see it, it was not possible to access the statistics for non-use 1.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇪Germany szeidler Berlin

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024