Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Initialize authorization mode for reporting jobs (#26762) #26924

Merged
merged 1 commit into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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