Initialize authorization mode for reporting jobs (#26762) (#26924)

This commit is contained in:
Larry Gregory 2018-12-11 07:34:44 -05:00 committed by GitHub
parent 48c2928965
commit 1ced518ccb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View file

@ -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);

View file

@ -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);
};

View file

@ -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 }