From 7142ba265ff13ade871929bb85f28d8664681f2b Mon Sep 17 00:00:00 2001 From: Timothy Sullivan Date: Wed, 13 Oct 2021 20:43:52 -0700 Subject: [PATCH 1/3] [Reporting] Forward-port config deprecation fixes from 7.x --- .../reporting/server/config/index.test.ts | 10 +++--- .../plugins/reporting/server/config/index.ts | 34 ++++++++++++++----- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/x-pack/plugins/reporting/server/config/index.test.ts b/x-pack/plugins/reporting/server/config/index.test.ts index f8426fd24852c..1a75f6dfec3bd 100644 --- a/x-pack/plugins/reporting/server/config/index.test.ts +++ b/x-pack/plugins/reporting/server/config/index.test.ts @@ -39,11 +39,9 @@ describe('deprecations', () => { ['.foo', '.reporting'].forEach((index) => { it('logs a warning if index is set', () => { const { messages } = applyReportingDeprecations({ index, roles: { enabled: false } }); - expect(messages).toMatchInlineSnapshot(` - Array [ - "Multitenancy by changing \\"kibana.index\\" will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details", - ] - `); + expect(messages).toMatchObject([ + 'Multitenancy by changing "xpack.reporting.index" will not be supported in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details', + ]); }); }); @@ -51,7 +49,7 @@ describe('deprecations', () => { const { messages } = applyReportingDeprecations({ roles: { enabled: true } }); expect(messages).toMatchInlineSnapshot(` Array [ - "Granting reporting privilege through a \\"reporting_user\\" role will not be supported starting in 8.0. Please set \\"xpack.reporting.roles.enabled\\" to \\"false\\" and grant reporting privileges to users using Kibana application privileges **Management > Security > Roles**.", + "Use Kibana application privileges to grant reporting privileges. Using \\"xpack.reporting.roles.allow\\" to grant reporting privileges prevents users from using API Keys to create reports. The \\"xpack.reporting.roles.enabled\\" setting will default to false in a future release.", ] `); }); diff --git a/x-pack/plugins/reporting/server/config/index.ts b/x-pack/plugins/reporting/server/config/index.ts index 45a71d05165ba..a45c084131a4d 100644 --- a/x-pack/plugins/reporting/server/config/index.ts +++ b/x-pack/plugins/reporting/server/config/index.ts @@ -30,15 +30,19 @@ export const config: PluginConfigDescriptor = { values: { fromPath }, }), message: i18n.translate('xpack.reporting.deprecations.reportingIndex.description', { - defaultMessage: `Multitenancy by changing "kibana.index" will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details`, + defaultMessage: + `Multitenancy by changing "xpack.reporting.index" will not be supported in 8.0.` + + ` See https://ela.st/kbn-remove-legacy-multitenancy for more details`, }), correctiveActions: { manualSteps: [ i18n.translate('xpack.reporting.deprecations.reportingIndex.manualStepOne', { - defaultMessage: `If you rely on this setting to achieve multitenancy you should use Spaces, cross-cluster replication, or cross-cluster search instead.`, + defaultMessage: `Remove the "xpack.reporting.index" setting.`, }), i18n.translate('xpack.reporting.deprecations.reportingIndex.manualStepTwo', { - defaultMessage: `To migrate to Spaces, we encourage using saved object management to export your saved objects from a tenant into the default tenant in a space.`, + defaultMessage: + `Reindex reports stored in a custom reporting index into the default ".reporting-*"` + + ` indices or regenerate the reports to be able to access them in 8.0.`, }), ], }, @@ -47,25 +51,37 @@ export const config: PluginConfigDescriptor = { if (reporting?.roles?.enabled !== false) { addDeprecation({ + level: 'warning', title: i18n.translate('xpack.reporting.deprecations.reportingRoles.title', { defaultMessage: 'Setting "{fromPath}.roles" is deprecated', values: { fromPath }, }), + // TODO: once scheduled reports is released, restate this to say that we have no access to scheduled reporting. + // https://github.com/elastic/kibana/issues/79905 message: i18n.translate('xpack.reporting.deprecations.reportingRoles.description', { defaultMessage: - `Granting reporting privilege through a "reporting_user" role will not be supported` + - ` starting in 8.0. Please set "xpack.reporting.roles.enabled" to "false" and grant reporting privileges to users` + - ` using Kibana application privileges **Management > Security > Roles**.`, + `Use Kibana application privileges to grant reporting privileges.` + + ` Using "{fromPath}.roles.allow" to grant reporting privileges` + + ` prevents users from using API Keys to create reports.` + + ` The "{fromPath}.roles.enabled" setting will default to false` + + ` in a future release.`, + values: { fromPath }, }), correctiveActions: { manualSteps: [ i18n.translate('xpack.reporting.deprecations.reportingRoles.manualStepOne', { - defaultMessage: `Set 'xpack.reporting.roles.enabled' to 'false' in your kibana configs.`, + defaultMessage: `Set "xpack.reporting.roles.enabled" to "false" in kibana.yml.`, }), i18n.translate('xpack.reporting.deprecations.reportingRoles.manualStepTwo', { defaultMessage: - `Grant reporting privileges to users using Kibana application privileges` + - ` under **Management > Security > Roles**.`, + `Create one or more roles that grant the Kibana application` + + ` privilege for reporting from **Management > Security > Roles**.`, + }), + i18n.translate('xpack.reporting.deprecations.reportingRoles.manualStepThree', { + defaultMessage: + `Grant reporting privileges to users by assigning one of the new roles.` + + ` Users assigned a reporting role specified in "xpack.reporting.roles.allow"` + + ` will no longer have reporting privileges, they must be assigned an application privilege based role.`, }), ], }, From fa81295a72180fafb46ed6be57a43b396337c8e5 Mon Sep 17 00:00:00 2001 From: Timothy Sullivan Date: Thu, 14 Oct 2021 07:43:16 -0700 Subject: [PATCH 2/3] remove index deprecation --- .../plugins/reporting/server/config/index.ts | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/x-pack/plugins/reporting/server/config/index.ts b/x-pack/plugins/reporting/server/config/index.ts index a45c084131a4d..91e5fbf572ecf 100644 --- a/x-pack/plugins/reporting/server/config/index.ts +++ b/x-pack/plugins/reporting/server/config/index.ts @@ -23,32 +23,6 @@ export const config: PluginConfigDescriptor = { unused('capture.viewport'), // deprecated as unused since 7.16 (settings, fromPath, addDeprecation) => { const reporting = get(settings, fromPath); - if (reporting?.index) { - addDeprecation({ - title: i18n.translate('xpack.reporting.deprecations.reportingIndex.title', { - defaultMessage: 'Setting "{fromPath}.index" is deprecated', - values: { fromPath }, - }), - message: i18n.translate('xpack.reporting.deprecations.reportingIndex.description', { - defaultMessage: - `Multitenancy by changing "xpack.reporting.index" will not be supported in 8.0.` + - ` See https://ela.st/kbn-remove-legacy-multitenancy for more details`, - }), - correctiveActions: { - manualSteps: [ - i18n.translate('xpack.reporting.deprecations.reportingIndex.manualStepOne', { - defaultMessage: `Remove the "xpack.reporting.index" setting.`, - }), - i18n.translate('xpack.reporting.deprecations.reportingIndex.manualStepTwo', { - defaultMessage: - `Reindex reports stored in a custom reporting index into the default ".reporting-*"` + - ` indices or regenerate the reports to be able to access them in 8.0.`, - }), - ], - }, - }); - } - if (reporting?.roles?.enabled !== false) { addDeprecation({ level: 'warning', From 1203ca4467e72a58882974dae509ac7e4acac388 Mon Sep 17 00:00:00 2001 From: Timothy Sullivan Date: Thu, 14 Oct 2021 07:45:46 -0700 Subject: [PATCH 3/3] fix test --- x-pack/plugins/reporting/server/config/index.test.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/x-pack/plugins/reporting/server/config/index.test.ts b/x-pack/plugins/reporting/server/config/index.test.ts index 1a75f6dfec3bd..9e6c8f35308f9 100644 --- a/x-pack/plugins/reporting/server/config/index.test.ts +++ b/x-pack/plugins/reporting/server/config/index.test.ts @@ -36,15 +36,6 @@ const applyReportingDeprecations = (settings: Record = {}) => { }; describe('deprecations', () => { - ['.foo', '.reporting'].forEach((index) => { - it('logs a warning if index is set', () => { - const { messages } = applyReportingDeprecations({ index, roles: { enabled: false } }); - expect(messages).toMatchObject([ - 'Multitenancy by changing "xpack.reporting.index" will not be supported in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details', - ]); - }); - }); - it('logs a warning if roles.enabled: true is set', () => { const { messages } = applyReportingDeprecations({ roles: { enabled: true } }); expect(messages).toMatchInlineSnapshot(`