Skip to content

Commit

Permalink
Initialize authorization mode for reporting jobs (elastic#26762) (ela…
Browse files Browse the repository at this point in the history
  • Loading branch information
legrego authored Dec 11, 2018
1 parent 48c2928 commit 1ced518
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 @@ -25,6 +25,11 @@ export const getCustomLogo = async ({
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,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
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 @@ -14,6 +14,7 @@ type SavedObjectClient = any;
export interface KbnServer {
info: { protocol: string };
config: () => ConfigObject;
plugins: Record<string, any>;
savedObjects: {
getScopedSavedObjectsClient: (
fakeRequest: { headers: object; getBasePath: () => string }
Expand Down

0 comments on commit 1ced518

Please sign in to comment.