Skip to content

Commit

Permalink
Initialize authorization mode for reporting jobs (#26762) (#26926)
Browse files Browse the repository at this point in the history
  • Loading branch information
legrego authored Dec 11, 2018
1 parent 00aaba8 commit 62af525
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/reporting/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
export interface KbnServer {
config: () => ConfigObject;
plugins: Record<string, any>;
}

export interface ConfigObject {
Expand Down

0 comments on commit 62af525

Please sign in to comment.