From 79d8e0342dc1b6dc73a2311e1b1eda420ade8489 Mon Sep 17 00:00:00 2001 From: Zac Romero Date: Wed, 12 Jun 2019 13:54:11 +0300 Subject: [PATCH 1/7] Add new bot account settings page. --- .../__snapshots__/admin_console.test.jsx.snap | 5 ++ components/admin_console/admin_definition.jsx | 40 +++++++--- .../__snapshots__/admin_sidebar.test.jsx.snap | 75 +++++++++++++++++-- i18n/en.json | 3 + 4 files changed, 109 insertions(+), 14 deletions(-) diff --git a/components/admin_console/__snapshots__/admin_console.test.jsx.snap b/components/admin_console/__snapshots__/admin_console.test.jsx.snap index f64d420a7fd6..a5f0c75b682e 100644 --- a/components/admin_console/__snapshots__/admin_console.test.jsx.snap +++ b/components/admin_console/__snapshots__/admin_console.test.jsx.snap @@ -172,6 +172,11 @@ exports[`components/AdminConsole should generate the routes 1`] = ` path="/integrations/integration_management" render={[Function]} /> + Bot Accounts**. Bot accounts are similar to user accounts except they cannot be used to log in. See [documentation](https://mattermost.com/pl/default-bot-accounts) to learn more.', - help_text_markdown: true, - }, { type: Constants.SettingsTypes.TYPE_BOOL, key: 'ServiceSettings.EnableUserAccessTokens', @@ -3417,6 +3408,37 @@ export default { }, ], }, + }, + bot_accounts: { + url: 'integrations/bot_accounts', + title: t('admin.integrations.botAccounts'), + title_default: 'Bot Accounts', + schema: { + id: "BotAccountSettings", + name: t('admin.integrations.botAccount.title'), + name_default: "Bot Accounts", + settings: [ + { + type: Constants.SettingsTypes.TYPE_BOOL, + key: 'ServiceSettings.EnableBotAccountCreation', + label: t('admin.service.enableBotTitle'), + label_default: 'Enable Bot Account Creation: ', + help_text: t('admin.service.enableBotAccountCreation'), + help_text_default: 'When true, users can create bot accounts for integrations in **Integrations > Bot Accounts**. Bot accounts are similar to user accounts except they cannot be used to log in. See [documentation](https://mattermost.com/pl/default-bot-accounts) to learn more.', + help_text_markdown: true, + }, + { + type: Constants.SettingsTypes.TYPE_BOOL, + key: 'ServiceSettings.DisableBotsWhenOwnerIsDeactivated', + label: t('admin.service.disableBotOwnerDeactivatedTitle'), + label_default: 'Disable bot accounts when owner is deactivated', + help_text: t('admin.service.disableBotWhenOwnerIsDeactivated'), + help_text_default: 'When a user is deactivated, disables all bot accounts managed by the user. To re-enable bot accounts, go to **Integrations > Bot Accounts**', + isDisabled: it.stateEquals('ServiceSettings.EnableBotAccountCreation', false), + help_text_markdown: true, + } + ] + } }, gif: { url: 'integrations/gif', diff --git a/components/admin_console/admin_sidebar/__snapshots__/admin_sidebar.test.jsx.snap b/components/admin_console/admin_sidebar/__snapshots__/admin_sidebar.test.jsx.snap index ec49b9de4b98..57406ccadd99 100644 --- a/components/admin_console/admin_sidebar/__snapshots__/admin_sidebar.test.jsx.snap +++ b/components/admin_console/admin_sidebar/__snapshots__/admin_sidebar.test.jsx.snap @@ -513,6 +513,19 @@ exports[`components/AdminSidebar should match snapshot 1`] = ` /> + } + /> + + } + /> + + } + /> + + } + /> + + } + /> + Bot Accounts**", "admin.service.enableBotAccountCreation": "When true, users can create bot accounts for integrations in **Integrations > Bot Accounts**. Bot accounts are similar to user accounts except they cannot be used to log in. See [documentation](https://mattermost.com/pl/default-bot-accounts) to learn more.", "admin.service.enableBotTitle": "Enable Bot Account Creation: ", "admin.service.enforceMfaDesc": "When true, [multi-factor authentication](!https://docs.mattermost.com/deployment/auth.html) is required for login. New users will be required to configure MFA on signup. Logged in users without MFA configured are redirected to the MFA setup page until configuration is complete.\n \nIf your system has users with login methods other than AD/LDAP and email, MFA must be enforced with the authentication provider outside of Mattermost.", From 9c2cec5c8b6af9e72bb85c24dc2dff23054d1702 Mon Sep 17 00:00:00 2001 From: Zac Romero Date: Wed, 12 Jun 2019 14:58:16 +0300 Subject: [PATCH 2/7] Fix JS linting errors. --- components/admin_console/admin_definition.jsx | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/components/admin_console/admin_definition.jsx b/components/admin_console/admin_definition.jsx index 09fd6dff38c4..a88e3d9c433d 100644 --- a/components/admin_console/admin_definition.jsx +++ b/components/admin_console/admin_definition.jsx @@ -3409,36 +3409,36 @@ export default { ], }, }, - bot_accounts: { + bot_accounts: { url: 'integrations/bot_accounts', - title: t('admin.integrations.botAccounts'), - title_default: 'Bot Accounts', - schema: { - id: "BotAccountSettings", - name: t('admin.integrations.botAccount.title'), - name_default: "Bot Accounts", - settings: [ - { - type: Constants.SettingsTypes.TYPE_BOOL, - key: 'ServiceSettings.EnableBotAccountCreation', - label: t('admin.service.enableBotTitle'), - label_default: 'Enable Bot Account Creation: ', - help_text: t('admin.service.enableBotAccountCreation'), - help_text_default: 'When true, users can create bot accounts for integrations in **Integrations > Bot Accounts**. Bot accounts are similar to user accounts except they cannot be used to log in. See [documentation](https://mattermost.com/pl/default-bot-accounts) to learn more.', - help_text_markdown: true, - }, - { - type: Constants.SettingsTypes.TYPE_BOOL, - key: 'ServiceSettings.DisableBotsWhenOwnerIsDeactivated', - label: t('admin.service.disableBotOwnerDeactivatedTitle'), - label_default: 'Disable bot accounts when owner is deactivated', - help_text: t('admin.service.disableBotWhenOwnerIsDeactivated'), - help_text_default: 'When a user is deactivated, disables all bot accounts managed by the user. To re-enable bot accounts, go to **Integrations > Bot Accounts**', - isDisabled: it.stateEquals('ServiceSettings.EnableBotAccountCreation', false), - help_text_markdown: true, - } - ] - } + title: t('admin.integrations.botAccounts'), + title_default: 'Bot Accounts', + schema: { + id: 'BotAccountSettings', + name: t('admin.integrations.botAccount.title'), + name_default: 'Bot Accounts', + settings: [ + { + type: Constants.SettingsTypes.TYPE_BOOL, + key: 'ServiceSettings.EnableBotAccountCreation', + label: t('admin.service.enableBotTitle'), + label_default: 'Enable Bot Account Creation: ', + help_text: t('admin.service.enableBotAccountCreation'), + help_text_default: 'When true, users can create bot accounts for integrations in **Integrations > Bot Accounts**. Bot accounts are similar to user accounts except they cannot be used to log in. See [documentation](https://mattermost.com/pl/default-bot-accounts) to learn more.', + help_text_markdown: true, + }, + { + type: Constants.SettingsTypes.TYPE_BOOL, + key: 'ServiceSettings.DisableBotsWhenOwnerIsDeactivated', + label: t('admin.service.disableBotOwnerDeactivatedTitle'), + label_default: 'Disable bot accounts when owner is deactivated', + help_text: t('admin.service.disableBotWhenOwnerIsDeactivated'), + help_text_default: 'When a user is deactivated, disables all bot accounts managed by the user. To re-enable bot accounts, go to **Integrations > Bot Accounts**', + isDisabled: it.stateEquals('ServiceSettings.EnableBotAccountCreation', false), + help_text_markdown: true, + }, + ], + }, }, gif: { url: 'integrations/gif', From df8e033b5689c9d5592a14708e5462d41d9d3c75 Mon Sep 17 00:00:00 2001 From: Zac Romero Date: Wed, 12 Jun 2019 15:13:46 +0300 Subject: [PATCH 3/7] Fix localization file. --- i18n/en.json | 1 + 1 file changed, 1 insertion(+) diff --git a/i18n/en.json b/i18n/en.json index 5f7db219b26d..cc141c9c5d21 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -680,6 +680,7 @@ "admin.image.storeDescription": "Storage system where files and image attachments are saved.\n \nSelecting \"Amazon S3\" enables fields to enter your Amazon credentials and bucket details.\n \nSelecting \"Local File System\" enables the field to specify a local file directory.", "admin.image.storeLocal": "Local File System", "admin.image.storeTitle": "File Storage System:", + "admin.integrations.botAccount.title": "Bot Accounts", "admin.integrations.botAccounts": "Bot Accounts", "admin.integrations.cors": "CORS", "admin.integrations.gif": "GIF (Beta)", From 2e14e32129802f13dd2a68d9a2697bb83a9feac8 Mon Sep 17 00:00:00 2001 From: Zachary Romero Date: Thu, 13 Jun 2019 21:15:48 +0200 Subject: [PATCH 4/7] Apply suggestions from code review Co-Authored-By: Jason Blais <13119842+jasonblais@users.noreply.github.com> --- components/admin_console/admin_definition.jsx | 4 ++-- i18n/en.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/admin_console/admin_definition.jsx b/components/admin_console/admin_definition.jsx index a88e3d9c433d..7c1e07cbd203 100644 --- a/components/admin_console/admin_definition.jsx +++ b/components/admin_console/admin_definition.jsx @@ -3431,9 +3431,9 @@ export default { type: Constants.SettingsTypes.TYPE_BOOL, key: 'ServiceSettings.DisableBotsWhenOwnerIsDeactivated', label: t('admin.service.disableBotOwnerDeactivatedTitle'), - label_default: 'Disable bot accounts when owner is deactivated', + label_default: 'Disable bot accounts when owner is deactivated:', help_text: t('admin.service.disableBotWhenOwnerIsDeactivated'), - help_text_default: 'When a user is deactivated, disables all bot accounts managed by the user. To re-enable bot accounts, go to **Integrations > Bot Accounts**', + help_text_default: 'When a user is deactivated, disables all bot accounts managed by the user. To re-enable bot accounts, go to **Integrations > Bot Accounts**.', isDisabled: it.stateEquals('ServiceSettings.EnableBotAccountCreation', false), help_text_markdown: true, }, diff --git a/i18n/en.json b/i18n/en.json index cc141c9c5d21..5af4660632e7 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -1213,8 +1213,8 @@ "admin.service.corsTitle": "Enable cross-origin requests from:", "admin.service.developerDesc": "When true, JavaScript errors are shown in a purple bar at the top of the user interface. Not recommended for use in production. ", "admin.service.developerTitle": "Enable Developer Mode: ", - "admin.service.disableBotOwnerDeactivatedTitle": "Disable bot accounts when owner is deactivated", - "admin.service.disableBotWhenOwnerIsDeactivated": "When a user is deactivated, disables all bot accounts managed by the user. To re-enable bot accounts, go to **Integrations > Bot Accounts**", + "admin.service.disableBotOwnerDeactivatedTitle": "Disable bot accounts when owner is deactivated:", + "admin.service.disableBotWhenOwnerIsDeactivated": "When a user is deactivated, disables all bot accounts managed by the user. To re-enable bot accounts, go to **Integrations > Bot Accounts**.", "admin.service.enableBotAccountCreation": "When true, users can create bot accounts for integrations in **Integrations > Bot Accounts**. Bot accounts are similar to user accounts except they cannot be used to log in. See [documentation](https://mattermost.com/pl/default-bot-accounts) to learn more.", "admin.service.enableBotTitle": "Enable Bot Account Creation: ", "admin.service.enforceMfaDesc": "When true, [multi-factor authentication](!https://docs.mattermost.com/deployment/auth.html) is required for login. New users will be required to configure MFA on signup. Logged in users without MFA configured are redirected to the MFA setup page until configuration is complete.\n \nIf your system has users with login methods other than AD/LDAP and email, MFA must be enforced with the authentication provider outside of Mattermost.", From 3368759c4c740425a3848836a0f5999d57e7761d Mon Sep 17 00:00:00 2001 From: Zac Romero Date: Thu, 13 Jun 2019 21:22:59 +0200 Subject: [PATCH 5/7] Always have the DisableBotsWhenOwnerIsDeactivated setting enabled --- components/admin_console/admin_definition.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/components/admin_console/admin_definition.jsx b/components/admin_console/admin_definition.jsx index 7c1e07cbd203..004407884eb6 100644 --- a/components/admin_console/admin_definition.jsx +++ b/components/admin_console/admin_definition.jsx @@ -3434,7 +3434,6 @@ export default { label_default: 'Disable bot accounts when owner is deactivated:', help_text: t('admin.service.disableBotWhenOwnerIsDeactivated'), help_text_default: 'When a user is deactivated, disables all bot accounts managed by the user. To re-enable bot accounts, go to **Integrations > Bot Accounts**.', - isDisabled: it.stateEquals('ServiceSettings.EnableBotAccountCreation', false), help_text_markdown: true, }, ], From f1172c463eff0e225bd7afdfb66ea0647cc32a11 Mon Sep 17 00:00:00 2001 From: Zac Romero Date: Sun, 16 Jun 2019 11:20:49 +0200 Subject: [PATCH 6/7] botAccount to botAccounts title change. --- components/admin_console/admin_definition.jsx | 2 +- i18n/en.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/admin_console/admin_definition.jsx b/components/admin_console/admin_definition.jsx index 004407884eb6..b95ef209e291 100644 --- a/components/admin_console/admin_definition.jsx +++ b/components/admin_console/admin_definition.jsx @@ -3415,7 +3415,7 @@ export default { title_default: 'Bot Accounts', schema: { id: 'BotAccountSettings', - name: t('admin.integrations.botAccount.title'), + name: t('admin.integrations.botAccounts.title'), name_default: 'Bot Accounts', settings: [ { diff --git a/i18n/en.json b/i18n/en.json index 5af4660632e7..73d73b6e51d4 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -680,7 +680,7 @@ "admin.image.storeDescription": "Storage system where files and image attachments are saved.\n \nSelecting \"Amazon S3\" enables fields to enter your Amazon credentials and bucket details.\n \nSelecting \"Local File System\" enables the field to specify a local file directory.", "admin.image.storeLocal": "Local File System", "admin.image.storeTitle": "File Storage System:", - "admin.integrations.botAccount.title": "Bot Accounts", + "admin.integrations.botAccounts.title": "Bot Accounts", "admin.integrations.botAccounts": "Bot Accounts", "admin.integrations.cors": "CORS", "admin.integrations.gif": "GIF (Beta)", From 50170a4d0b5d94ca5cd88c253de01c3feee28d3a Mon Sep 17 00:00:00 2001 From: Zac Romero Date: Sun, 16 Jun 2019 11:29:52 +0200 Subject: [PATCH 7/7] Fix internationalization files --- i18n/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/en.json b/i18n/en.json index 73d73b6e51d4..73500194736a 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -680,8 +680,8 @@ "admin.image.storeDescription": "Storage system where files and image attachments are saved.\n \nSelecting \"Amazon S3\" enables fields to enter your Amazon credentials and bucket details.\n \nSelecting \"Local File System\" enables the field to specify a local file directory.", "admin.image.storeLocal": "Local File System", "admin.image.storeTitle": "File Storage System:", - "admin.integrations.botAccounts.title": "Bot Accounts", "admin.integrations.botAccounts": "Bot Accounts", + "admin.integrations.botAccounts.title": "Bot Accounts", "admin.integrations.cors": "CORS", "admin.integrations.gif": "GIF (Beta)", "admin.integrations.integrationManagement": "Integration Management",