diff --git a/x-pack/plugins/reporting/export_types/csv/server/execute_job.js b/x-pack/plugins/reporting/export_types/csv/server/execute_job.js index baa1cd458c8a0..dfe4bca34539c 100644 --- a/x-pack/plugins/reporting/export_types/csv/server/execute_job.js +++ b/x-pack/plugins/reporting/export_types/csv/server/execute_job.js @@ -46,6 +46,11 @@ function executeJobFn(server) { getBasePath: () => basePath || serverBasePath, }; + if (server.plugins.security) { + const { authorization } = server.plugins.security; + await authorization.mode.initialize(fakeRequest); + } + const callEndpoint = (endpoint, clientParams = {}, options = {}) => { return callWithRequest(fakeRequest, endpoint, clientParams, options); }; diff --git a/x-pack/plugins/reporting/export_types/printable_pdf/server/execute_job/index.js b/x-pack/plugins/reporting/export_types/printable_pdf/server/execute_job/index.js index c340546b868f8..355e5a35da783 100644 --- a/x-pack/plugins/reporting/export_types/printable_pdf/server/execute_job/index.js +++ b/x-pack/plugins/reporting/export_types/printable_pdf/server/execute_job/index.js @@ -67,6 +67,11 @@ function executeJobFn(server) { getBasePath: () => job.basePath || serverBasePath }; + if (server.plugins.security) { + const { authorization } = server.plugins.security; + await authorization.mode.initialize(fakeRequest); + } + const savedObjects = server.savedObjects; const savedObjectsClient = savedObjects.getScopedSavedObjectsClient(fakeRequest); const uiSettings = server.uiSettingsServiceFactory({ diff --git a/x-pack/plugins/reporting/types.d.ts b/x-pack/plugins/reporting/types.d.ts index cca035d6d5e52..2ba840ae0d3ad 100644 --- a/x-pack/plugins/reporting/types.d.ts +++ b/x-pack/plugins/reporting/types.d.ts @@ -5,6 +5,7 @@ */ export interface KbnServer { config: () => ConfigObject; + plugins: Record; } export interface ConfigObject {