From 7c39ca2f98f2f5431713ad387849217f12cc03c2 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Tue, 1 Sep 2015 15:18:48 +0000 Subject: Bug 1200610: jsonrpc API requests do not work when "Require API-Key authentication for API requests" is enabled due to missing API tokens --- extensions/EditComments/web/js/editcomments.js | 4 +++- extensions/GuidedBugEntry/web/js/guided.js | 9 ++++++--- extensions/MyDashboard/web/js/flags.js | 4 +++- extensions/MyDashboard/web/js/query.js | 10 ++++++++-- .../en/default/pages/remo-form-payment.html.tmpl | 3 ++- extensions/Review/web/js/review_history.js | 17 +++++++++++++---- js/bug.js | 5 ++++- js/instant-search.js | 3 ++- template/en/default/search/search-instant.html.tmpl | 1 + 9 files changed, 42 insertions(+), 14 deletions(-) diff --git a/extensions/EditComments/web/js/editcomments.js b/extensions/EditComments/web/js/editcomments.js index 91763fa62..a4e3014d5 100644 --- a/extensions/EditComments/web/js/editcomments.js +++ b/extensions/EditComments/web/js/editcomments.js @@ -47,7 +47,9 @@ function editComment(comment_count, comment_id) { version: "1.1", method: "EditComments.comments", id: comment_id, - params: { comment_ids: [ comment_id ] } + params: { comment_ids: [ comment_id ], + Bugzilla_api_token : (BUGZILLA.api_token ? BUGZILLA.api_token : '') + } }) ); } diff --git a/extensions/GuidedBugEntry/web/js/guided.js b/extensions/GuidedBugEntry/web/js/guided.js index 339a6fc65..98ad6fd17 100644 --- a/extensions/GuidedBugEntry/web/js/guided.js +++ b/extensions/GuidedBugEntry/web/js/guided.js @@ -257,7 +257,8 @@ var product = { id: ++this._counter, params: { names: [productName], - exclude_fields: ['internals', 'milestones'] + exclude_fields: ['internals', 'milestones'], + Bugzilla_api_token : (BUGZILLA.api_token ? BUGZILLA.api_token : '') } } ) @@ -445,7 +446,8 @@ var dupes = { id: ++this._counter, params: { ids: [ bugID ], - cc : ccObject + cc : ccObject, + Bugzilla_api_token: (BUGZILLA.api_token ? BUGZILLA.api_token : '') } }) ); @@ -556,7 +558,8 @@ var dupes = { summary: dupes.getSummary(), limit: 12, include_fields: [ "id", "summary", "status", "resolution", - "update_token", "cc", "component" ] + "update_token", "cc", "component" ], + Bugzilla_api_token: (BUGZILLA.api_token ? BUGZILLA.api_token : '') } }; diff --git a/extensions/MyDashboard/web/js/flags.js b/extensions/MyDashboard/web/js/flags.js index 0fcf75618..e8c175155 100644 --- a/extensions/MyDashboard/web/js/flags.js +++ b/extensions/MyDashboard/web/js/flags.js @@ -50,7 +50,9 @@ YUI({ version: "1.1", method: "MyDashboard.run_flag_query", id: counter, - params: { type : type } + params: { type : type, + Bugzilla_api_token : (BUGZILLA.api_token ? BUGZILLA.api_token : '') + } }; var stringified = Y.JSON.stringify(json_object); diff --git a/extensions/MyDashboard/web/js/query.js b/extensions/MyDashboard/web/js/query.js index 42dfca561..9cea27f87 100644 --- a/extensions/MyDashboard/web/js/query.js +++ b/extensions/MyDashboard/web/js/query.js @@ -122,7 +122,9 @@ YUI({ version: "1.1", method: "MyDashboard.run_bug_query", id: counter, - params: { query : query_name } + params: { query : query_name, + Bugzilla_api_token : (BUGZILLA.api_token ? BUGZILLA.api_token : '') + } }; bugQuery.sendRequest({ @@ -206,7 +208,11 @@ YUI({ var lastChangesParams = { version: "1.1", method: "MyDashboard.run_last_changes", - params: { bug_id: data.bug_id, changeddate_api: data.changeddate_api } + params: { + bug_id: data.bug_id, + changeddate_api: data.changeddate_api, + Bugzilla_api_token : (BUGZILLA.api_token ? BUGZILLA.api_token : '') + } }; lastChangesQuery.sendRequest({ diff --git a/extensions/REMO/template/en/default/pages/remo-form-payment.html.tmpl b/extensions/REMO/template/en/default/pages/remo-form-payment.html.tmpl index ad5cbdb45..3994e13fd 100644 --- a/extensions/REMO/template/en/default/pages/remo-form-payment.html.tmpl +++ b/extensions/REMO/template/en/default/pages/remo-form-payment.html.tmpl @@ -125,7 +125,8 @@ function getBugInfo (e, div) { id: bug_id, params: { ids: [ bug_id ], - include_fields: [ 'product', 'component', 'status', 'summary' ] + include_fields: [ 'product', 'component', 'status', 'summary' ], + Bugzilla_api_token : (BUGZILLA.api_token ? BUGZILLA.api_token : '') } }) ); diff --git a/extensions/Review/web/js/review_history.js b/extensions/Review/web/js/review_history.js index 4e31d2f73..8d016b009 100644 --- a/extensions/Review/web/js/review_history.js +++ b/extensions/Review/web/js/review_history.js @@ -127,7 +127,8 @@ params: { type_name: 'review', requestee: user, - include_fields: ['flag_id', 'status'] + include_fields: ['flag_id', 'status'], + Bugzilla_api_token : (BUGZILLA.api_token ? BUGZILLA.api_token : '') } }), cfg: { @@ -145,7 +146,10 @@ request: Y.JSON.stringify({ version: '1.1', method: 'Review.flag_activity', - params: { flag_ids: flag_ids } + params: { + flag_ids: flag_ids, + Bugzilla_api_token: (BUGZILLA.api_token ? BUGZILLA.api_token : '') + } }), cfg: { method: 'POST', @@ -181,7 +185,11 @@ request: Y.JSON.stringify({ version: '1.1', method: 'Bug.get', - params: { ids: bug_ids, include_fields: ['summary', 'id'] } + params: { + ids: bug_ids, + include_fields: ['summary', 'id'], + Bugzilla_api_token: (BUGZILLA.api_token ? BUGZILLA.api_token : '') + } }), cfg: { method: 'POST', @@ -220,7 +228,8 @@ method: 'Bug.attachments', params: { attachment_ids: attachment_ids, - include_fields: ['id', 'description'] + include_fields: ['id', 'description'], + Bugzilla_api_token : (BUGZILLA.api_token ? BUGZILLA.api_token : '') } }), cfg: { diff --git a/js/bug.js b/js/bug.js index 1089bce99..308317c3e 100644 --- a/js/bug.js +++ b/js/bug.js @@ -184,7 +184,10 @@ YAHOO.bugzilla.dupTable = { var args = JSON.stringify({ version: "1.1", method: 'MyDashboard.bug_interest_unmark', - params: { bug_ids: bug_ids }, + params: { + bug_ids: bug_ids, + Bugzilla_api_token: (BUGZILLA.api_token ? BUGZILLA.api_token : '') + }, }); var callbacks = { failure: function(res) { diff --git a/js/instant-search.js b/js/instant-search.js index a3f051f2f..8277b97a9 100644 --- a/js/instant-search.js +++ b/js/instant-search.js @@ -151,7 +151,8 @@ YAHOO.bugzilla.instantSearch = { product: YAHOO.bugzilla.instantSearch.getProduct(), summary: query, limit: 20, - include_fields: [ "id", "summary", "status", "resolution", "component" ] + include_fields: [ "id", "summary", "status", "resolution", "component" ], + Bugzilla_api_token : (BUGZILLA.api_token ? BUGZILLA.api_token : '') } }; diff --git a/template/en/default/search/search-instant.html.tmpl b/template/en/default/search/search-instant.html.tmpl index 5d75d1996..00f6434e9 100644 --- a/template/en/default/search/search-instant.html.tmpl +++ b/template/en/default/search/search-instant.html.tmpl @@ -10,6 +10,7 @@ [% PROCESS global/header.html.tmpl title = "Instant Search" + generate_api_token = 1 javascript_urls = [ 'extensions/GuidedBugEntry/web/js/products.js', 'js/instant-search.js', ] yui = [ 'datatable', 'container' ] -- cgit v1.2.3-24-g4f1b