From eb7226d8d061ecafa523910bf48b1b2649090dd1 Mon Sep 17 00:00:00 2001 From: Damien Bouvy Date: Mon, 24 Oct 2016 17:33:38 +0200 Subject: [PATCH] [FIX] website: prevent faulty 'no access' message for analytics 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. --- addons/website/static/src/js/website.backendDashboard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/static/src/js/website.backendDashboard.js b/addons/website/static/src/js/website.backendDashboard.js index ed241fd221534..35b27340c5f48 100644 --- a/addons/website/static/src/js/website.backendDashboard.js +++ b/addons/website/static/src/js/website.backendDashboard.js @@ -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);