mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* [ML] Fixing ml when spaces feature is disabled * correcting grammar in comment * fixing typo
This commit is contained in:
parent
97d6773fda
commit
7a021fde0b
2 changed files with 8 additions and 4 deletions
|
@ -26,7 +26,7 @@ interface Response {
|
|||
export function privilegesProvider(
|
||||
callWithRequest: callWithRequestType,
|
||||
xpackMainPlugin: XPackMainPlugin,
|
||||
isMlEnabled: () => Promise<boolean>
|
||||
isMlEnabledInSpace: () => Promise<boolean>
|
||||
) {
|
||||
const { isUpgradeInProgress } = upgradeCheckProvider(callWithRequest);
|
||||
async function getPrivileges(): Promise<Response> {
|
||||
|
@ -37,7 +37,7 @@ export function privilegesProvider(
|
|||
const securityDisabled = isSecurityDisabled(xpackMainPlugin);
|
||||
const license = checkLicense(xpackMainPlugin.info);
|
||||
const isPlatinumOrTrialLicense = license.licenseType === LICENSE_TYPE.FULL;
|
||||
const mlFeatureEnabledInSpace = await isMlEnabled();
|
||||
const mlFeatureEnabledInSpace = await isMlEnabledInSpace();
|
||||
|
||||
const setGettingPrivileges = isPlatinumOrTrialLicense
|
||||
? setFullGettingPrivileges
|
||||
|
|
|
@ -98,8 +98,12 @@ export function systemRoutes({
|
|||
async handler(request) {
|
||||
const callWithRequest = callWithRequestFactory(elasticsearchPlugin, request);
|
||||
try {
|
||||
const { isMlEnabled } = spacesUtilsProvider(spacesPlugin, request, config);
|
||||
const { getPrivileges } = privilegesProvider(callWithRequest, xpackMainPlugin, isMlEnabled);
|
||||
const spacesFeature = xpackMainPlugin.info.feature('spaces');
|
||||
const { isMlEnabledInSpace } = spacesFeature.isEnabled() ?
|
||||
spacesUtilsProvider(spacesPlugin, request, config) :
|
||||
{ isMlEnabledInSpace: async () => true }; // if spaces is disabled force isMlEnabledInSpace to be true
|
||||
|
||||
const { getPrivileges } = privilegesProvider(callWithRequest, xpackMainPlugin, isMlEnabledInSpace);
|
||||
return await getPrivileges();
|
||||
} catch (error) {
|
||||
return wrapError(error);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue