Skip to content

Commit

Permalink
[Reporting] Clarify deprecation changes of the roles settings (#121349)
Browse files Browse the repository at this point in the history
* [Reporting] Clarify deprecation changes of the roles settings

* updates per feedback

* update test snapshots

* minor fix

* fix i18n

* remove formatting marks

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
tsullivan and kibanamachine authored Dec 16, 2021
1 parent 1dd669c commit f809278
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 63 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/reporting/server/config/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('deprecations', () => {
const { messages } = applyReportingDeprecations({ roles: { enabled: true } });
expect(messages).toMatchInlineSnapshot(`
Array [
"Use Kibana application privileges to grant reporting privileges. Using \\"xpack.reporting.roles.allow\\" to grant reporting privileges is deprecated. The \\"xpack.reporting.roles.enabled\\" setting will default to false in a future release.",
"The default mechanism for Reporting privileges will work differently in future versions, which will affect the behavior of this cluster. Set \\"xpack.reporting.roles.enabled\\" to \\"false\\" to adopt the future behavior before upgrading.",
]
`);
});
Expand Down
26 changes: 10 additions & 16 deletions x-pack/plugins/reporting/server/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,38 +30,32 @@ export const config: PluginConfigDescriptor<ReportingConfigType> = {
configPath: `${fromPath}.roles.enabled`,
level: 'warning',
title: i18n.translate('xpack.reporting.deprecations.reportingRoles.title', {
defaultMessage: 'Setting "{fromPath}.roles" is deprecated',
defaultMessage: `The "{fromPath}.roles" setting 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:
`Use Kibana application privileges to grant reporting privileges.` +
` Using "{fromPath}.roles.allow" to grant reporting privileges` +
` is deprecated.` +
` The "{fromPath}.roles.enabled" setting will default to false` +
` in a future release.`,
values: { fromPath },
`The default mechanism for Reporting privileges will work differently in future versions,` +
` which will affect the behavior of this cluster. Set "xpack.reporting.roles.enabled" to` +
` "false" to adopt the future behavior before upgrading.`,
}),
correctiveActions: {
manualSteps: [
i18n.translate('xpack.reporting.deprecations.reportingRoles.manualStepOne', {
defaultMessage: `Set "xpack.reporting.roles.enabled" to "false" in kibana.yml.`,
}),
i18n.translate('xpack.reporting.deprecations.reportingRoles.manualStepOnePartOne', {
defaultMessage: `Remove "xpack.reporting.roles.allow" to "false" in kibana.yml, if present.`,
}),
i18n.translate('xpack.reporting.deprecations.reportingRoles.manualStepTwo', {
defaultMessage:
`Create one or more roles that grant the Kibana application` +
` privilege for reporting from **Management > Security > Roles**.`,
defaultMessage: `Remove "xpack.reporting.roles.allow" in kibana.yml, if present.`,
}),
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.`,
`Go to Management > Security > Roles to create one or more roles that grant` +
` the Kibana application privilege for Reporting.`,
}),
i18n.translate('xpack.reporting.deprecations.reportingRoles.manualStepFour', {
defaultMessage: `Grant Reporting privileges to users by assigning one of the new roles.`,
}),
],
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 33 additions & 16 deletions x-pack/plugins/reporting/server/deprecations/reporting_role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,32 +57,40 @@ async function getUsersDeprecations(
): Promise<DeprecationsDetails[]> {
const usingDeprecatedConfig = !reportingCore.getContract().usesUiCapabilities();
const strings = {
title: i18n.translate('xpack.reporting.deprecations.reportingRoleUsersTitle', {
defaultMessage: 'The "{reportingUserRoleName}" role is deprecated: check user roles',
title: i18n.translate('xpack.reporting.deprecations.reportingRoleUsers.title', {
defaultMessage: `The "{reportingUserRoleName}" role is deprecated: check user roles`,
values: { reportingUserRoleName: REPORTING_USER_ROLE_NAME },
}),
message: i18n.translate('xpack.reporting.deprecations.reportingRoleUsersMessage', {
message: i18n.translate('xpack.reporting.deprecations.reportingRoleUsers.description', {
defaultMessage:
'Existing users have their Reporting privilege granted by a deprecated setting.',
`The default mechanism for Reporting privileges will work differently in future versions, and` +
` this cluster has users who have a deprecated role for this privilege.` +
` Set "xpack.reporting.roles.enabled" to "false" to adopt the future behavior before upgrading.`,
}),
manualSteps: (usersRoles: string) => [
...(usingDeprecatedConfig
? [
i18n.translate('xpack.reporting.deprecations.reportingRoleUsers.manualStepOne', {
defaultMessage: 'Set "xpack.reporting.roles.enabled: false" in kibana.yml.',
defaultMessage: `Set "xpack.reporting.roles.enabled" to "false" in kibana.yml.`,
}),
i18n.translate('xpack.reporting.deprecations.reportingRoleUsers.manualStepTwo', {
defaultMessage: 'Remove "xpack.reporting.roles.allow" in kibana.yml, if present.',
defaultMessage: `Remove "xpack.reporting.roles.allow" in kibana.yml, if present.`,
}),
]
: []),

i18n.translate('xpack.reporting.deprecations.reportingRoleUsers.manualStepThree', {
defaultMessage: 'Create a custom role with Kibana privileges to grant access to Reporting.',
defaultMessage:
`Go to Management > Security > Roles to create one or more roles that grant` +
` the Kibana application privilege for Reporting.`,
}),
i18n.translate('xpack.reporting.deprecations.reportingRoleUsers.manualStepFour', {
defaultMessage: `Grant Reporting privileges to users by assigning one of the new roles.`,
}),
i18n.translate('xpack.reporting.deprecations.reportingRoleUsers.manualStepFive', {
defaultMessage:
'Remove the "reporting_user" role from all users and add the custom role. The affected users are: {usersRoles}.',
`Remove the "reporting_user" role from all users and add the custom role.` +
` The affected users are: {usersRoles}.`,
values: { usersRoles },
}),
],
Expand Down Expand Up @@ -136,31 +144,40 @@ async function getRoleMappingsDeprecations(
): Promise<DeprecationsDetails[]> {
const usingDeprecatedConfig = !reportingCore.getContract().usesUiCapabilities();
const strings = {
title: i18n.translate('xpack.reporting.deprecations.reportingRoleMappingsTitle', {
defaultMessage: 'The "{reportingUserRoleName}" role is deprecated: check role mappings',
title: i18n.translate('xpack.reporting.deprecations.reportingRoleMappings.title', {
defaultMessage: `The "{reportingUserRoleName}" role is deprecated: check role mappings`,
values: { reportingUserRoleName: REPORTING_USER_ROLE_NAME },
}),
message: i18n.translate('xpack.reporting.deprecations.reportingRoleMappingsMessage', {
defaultMessage: 'Existing roles are mapped to a deprecated role for Reporting privileges',
message: i18n.translate('xpack.reporting.deprecations.reportingRoleMappings.description', {
defaultMessage:
`The default mechanism for Reporting privileges will work differently in future versions, and` +
` this cluster has role mappings that are mapped to a deprecated role for this privilege.` +
` Set "xpack.reporting.roles.enabled" to "false" to adopt the future behavior before upgrading.`,
}),
manualSteps: (roleMappings: string) => [
...(usingDeprecatedConfig
? [
i18n.translate('xpack.reporting.deprecations.reportingRoleMappings.manualStepOne', {
defaultMessage: 'Set "xpack.reporting.roles.enabled: false" in kibana.yml.',
defaultMessage: `Set "xpack.reporting.roles.enabled" to "false" in kibana.yml.`,
}),
i18n.translate('xpack.reporting.deprecations.reportingRoleMappings.manualStepTwo', {
defaultMessage: 'Remove "xpack.reporting.roles.allow" in kibana.yml, if present.',
defaultMessage: `Remove "xpack.reporting.roles.allow" in kibana.yml, if present.`,
}),
]
: []),

i18n.translate('xpack.reporting.deprecations.reportingRoleMappings.manualStepThree', {
defaultMessage: 'Create a custom role with Kibana privileges to grant access to Reporting.',
defaultMessage:
`Go to Management > Security > Roles to create one or more roles that grant` +
` the Kibana application privilege for Reporting.`,
}),
i18n.translate('xpack.reporting.deprecations.reportingRoleMappings.manualStepFour', {
defaultMessage: `Grant Reporting privileges to users by assigning one of the new roles.`,
}),
i18n.translate('xpack.reporting.deprecations.reportingRoleMappings.manualStepFive', {
defaultMessage:
'Remove the "reporting_user" role from all role mappings and add the custom role. The affected role mappings are: {roleMappings}.',
`Remove the "reporting_user" role from all role mappings and add the custom role.` +
` The affected role mappings are: {roleMappings}.`,
values: { roleMappings },
}),
],
Expand Down
Loading

0 comments on commit f809278

Please sign in to comment.