Skip to content

Commit

Permalink
[FIX] website: prevent faulty 'no access' message for analytics
Browse files Browse the repository at this point in the history
There are multiple scopes giving access to analytics api, like
https://www.googleapis.com/auth/analytics.readonly

Having a space at the end of the queried string prevents correct
scope detection; so a user who has, in fact, access will receive
a faulty error message.
  • Loading branch information
bouvyd committed Oct 24, 2016
1 parent 88d4881 commit eb7226d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/website/static/src/js/website.backendDashboard.js
Expand Up @@ -257,7 +257,7 @@ var Dashboard = Widget.extend(ControlPanelMixin, {
// Check if the user is authenticated and has the right to make API calls
if (!gapi.analytics.auth.getAuthResponse()) {
this.display_unauthorized_message($analytics_components, 'not_connected');
} else if (gapi.analytics.auth.getAuthResponse() && gapi.analytics.auth.getAuthResponse().scope.indexOf('https://www.googleapis.com/auth/analytics ') === -1) {
} else if (gapi.analytics.auth.getAuthResponse() && gapi.analytics.auth.getAuthResponse().scope.indexOf('https://www.googleapis.com/auth/analytics') === -1) {
this.display_unauthorized_message($analytics_components, 'no_right');
} else {
this.make_analytics_calls($analytics_components);
Expand Down

0 comments on commit eb7226d

Please sign in to comment.