kibana/x-pack/plugins/ml/server/lib/security_utils.js
Melissa Alvarez c47a0d5cdf
[ML] New Platform Migration - server (#38360)
* wip: pull out all server dependencies

* create new platform plugin

* shim newPlatform plugin into legacy init

* update server tests for migration refactor

* cleanup interfaces

* Only add ML links for sample data sets if full license from - 38120

* update test and fix typescript errors

* Remove unused types
2019-06-17 16:08:13 -04:00

20 lines
926 B
JavaScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
/*
* Contains utility functions related to x-pack security.
*/
export function isSecurityDisabled(xpackMainPlugin) {
const xpackInfo = (xpackMainPlugin && xpackMainPlugin.info);
// we assume that `xpack.isAvailable()` always returns `true` because we're inside x-pack
// if for whatever reason it returns `false`, `isSecurityDisabled()` would also return `false`
// which would result in follow-up behavior assuming security is enabled. This is intentional,
// because it results in more defensive behavior.
const securityInfo = (xpackInfo && xpackInfo.isAvailable() && xpackInfo.feature('security'));
return (securityInfo && securityInfo.isEnabled() === false);
}