When a normal user to view the report of the Google Analytics Api, I found that they need the 'administer google analytics settings' permission to get the statistics report display. Every time to view the statistics report, The permission check will go to function google_analytics_api_gapi to verify if the current user have a permission 'administer google analytics settings'. So this break the statistics report display and also effect the statistics block of Google Analytics Api.
So should we need to just check the 'access google analytics reports' permission to get the report shows to a user when they just want to view the google analytics of their node?
Related issue post
http://drupal.org/node/689138
Thank you.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 695480_improve_permissionsapi_reports.patch | 2.87 KB | greggles |
Comments
Comment #1
newsignature commentedWe've encountered this as well. In order to use the Google Analytics API as non-administrator (for example, to run it in cron in connection with our Drupal Most Popular module (http://www.drupalmostpopular.com), the 'administer Google Analytics settings' permission must be assigned to anonymous users.
On the other hand, the actual page for configuring Google Analytics API looks for the 'access administration pages' permission, which only the administrator should have. In fact, the only place the 'administer Google Analytics settings' permission is checked is in that one function, google_analytics_api_gapi().
As a result, it appears to be safe to grant the 'administer Google Analytics settings' permission to anonymous users. Perhaps in a future version this permission should be renamed to sound less foreboding. :-)
Comment #2
gregglesI think the function google_analytics_api_gapi should not check any permissions. That is the responsibility of the code that calls google_analytics_api_gapi
I also think that the permissions in this and the reports module are a bit poorly matched/named.
1. google_analytics_api_perm declares a permission "administer google analytics settings" but it's not about the "google analytics settings" its about the "google analytics API settings"
2. The reports module uses only one permissions "access google analytics reports" but it uses that for both the reports pages and the configuration page
Attached is a patch to fix all three of these issues. People will need to rebuild their menu after updating to this code.
Comment #3
vacilando commentedGreat, greggles, this is a more complete solution than what I had in #945274: Anonymous access to charts not working. Could please somebody apply this patch as soon as possible?
Comment #4
gregglesIt's been almost a month since I created this. I'd like to see at least a response from one of the current maintainers or I'll apply to become a co-maintainer so I can commit little things like this.
Comment #5
sonlinemedia commentedI have had to luck allowing anonymous user to view the Google Analytics on each page. I've set the permission to allow anonymous on "administer google analytics settings" but page says Access Denied...
Comment #6
vacilando commentedCould somebody kindly apply the #2 patch or add me to co-maintainers. Please.
Comment #7
raspberryman commentedApplied: http://drupalcode.org/project/google_analytics_api.git/commitdiff/d1a3c53
Thanks all!