mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
This commit is contained in:
parent
da37619e5e
commit
0134e552d1
1 changed files with 21 additions and 0 deletions
|
@ -3,6 +3,9 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
|
||||
import { callWithRequestFactory } from '../../lib/call_with_request_factory';
|
||||
import { isEsErrorFactory } from '../../lib/is_es_error_factory';
|
||||
import { wrapEsError, wrapUnknownError } from '../../lib/error_wrappers';
|
||||
|
@ -51,6 +54,24 @@ export const registerCcrRoutes = (server) => {
|
|||
pre: [ licensePreRouting ]
|
||||
},
|
||||
handler: async (request) => {
|
||||
const xpackMainPlugin = server.plugins.xpack_main;
|
||||
const xpackInfo = (xpackMainPlugin && xpackMainPlugin.info);
|
||||
|
||||
if (!xpackInfo) {
|
||||
// xpackInfo is updated via poll, so it may not be available until polling has begun.
|
||||
// In this rare situation, tell the client the service is temporarily unavailable.
|
||||
throw new Boom('Security info unavailable', { statusCode: 503 });
|
||||
}
|
||||
|
||||
const securityInfo = (xpackInfo && xpackInfo.isAvailable() && xpackInfo.feature('security'));
|
||||
if (!securityInfo || !securityInfo.isEnabled()) {
|
||||
// If security isn't enabled, let the user use CCR.
|
||||
return {
|
||||
hasPermission: true,
|
||||
missingClusterPrivileges: [],
|
||||
};
|
||||
}
|
||||
|
||||
const callWithRequest = callWithRequestFactory(server, request);
|
||||
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue