From d9d1da82cb332233c23992b4f3a51376eb3abe5a Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Tue, 7 Jan 2025 13:48:40 +1100 Subject: [PATCH] UX: Admin setting page consistency - Security (#30598) Create a basic config page that only contains security-related settings, to replace the "security" category view linked to from "Security settings" in the admin sidebar. --- .../admin-config-security-settings.js | 3 ++ .../addon/routes/admin-config-security.js | 8 +++++ .../admin/addon/routes/admin-route-map.js | 3 ++ .../templates/config-security-settings.gjs | 29 +++++++++++++++++++ .../app/lib/sidebar/admin-nav-map.js | 4 +-- config/locales/client.en.yml | 11 ++++--- config/routes.rb | 3 +- 7 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 app/assets/javascripts/admin/addon/controllers/admin-config-security-settings.js create mode 100644 app/assets/javascripts/admin/addon/routes/admin-config-security.js create mode 100644 app/assets/javascripts/admin/addon/templates/config-security-settings.gjs diff --git a/app/assets/javascripts/admin/addon/controllers/admin-config-security-settings.js b/app/assets/javascripts/admin/addon/controllers/admin-config-security-settings.js new file mode 100644 index 00000000000..36abf059ee2 --- /dev/null +++ b/app/assets/javascripts/admin/addon/controllers/admin-config-security-settings.js @@ -0,0 +1,3 @@ +import AdminAreaSettingsBaseController from "admin/controllers/admin-area-settings-base"; + +export default class AdminConfigSecuritySettingsController extends AdminAreaSettingsBaseController {} diff --git a/app/assets/javascripts/admin/addon/routes/admin-config-security.js b/app/assets/javascripts/admin/addon/routes/admin-config-security.js new file mode 100644 index 00000000000..243fbac6438 --- /dev/null +++ b/app/assets/javascripts/admin/addon/routes/admin-config-security.js @@ -0,0 +1,8 @@ +import DiscourseRoute from "discourse/routes/discourse"; +import { i18n } from "discourse-i18n"; + +export default class AdminConfigSecurityRoute extends DiscourseRoute { + titleToken() { + return i18n("admin.security.sidebar_link.security"); + } +} diff --git a/app/assets/javascripts/admin/addon/routes/admin-route-map.js b/app/assets/javascripts/admin/addon/routes/admin-route-map.js index 11ccaa9a339..84953041a79 100644 --- a/app/assets/javascripts/admin/addon/routes/admin-route-map.js +++ b/app/assets/javascripts/admin/addon/routes/admin-route-map.js @@ -300,6 +300,9 @@ export default function () { this.route("navigation", function () { this.route("settings", { path: "/" }); }); + this.route("security", function () { + this.route("settings", { path: "/" }); + }); } ); diff --git a/app/assets/javascripts/admin/addon/templates/config-security-settings.gjs b/app/assets/javascripts/admin/addon/templates/config-security-settings.gjs new file mode 100644 index 00000000000..4206053e475 --- /dev/null +++ b/app/assets/javascripts/admin/addon/templates/config-security-settings.gjs @@ -0,0 +1,29 @@ +import RouteTemplate from "ember-route-template"; +import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item"; +import DPageHeader from "discourse/components/d-page-header"; +import { i18n } from "discourse-i18n"; +import AdminAreaSettings from "admin/components/admin-area-settings"; + +export default RouteTemplate(); diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/admin-nav-map.js b/app/assets/javascripts/discourse/app/lib/sidebar/admin-nav-map.js index 39d7152640b..197091539b5 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/admin-nav-map.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/admin-nav-map.js @@ -181,9 +181,7 @@ export const ADMIN_NAV_MAP = [ links: [ { name: "admin_security", - route: "adminSiteSettingsCategory", - routeModels: ["security"], - query: { filter: "" }, + route: "adminConfig.security.settings", label: "admin.security.sidebar_link.security", icon: "lock", }, diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 91576681bc0..fcc210adba2 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -5140,6 +5140,9 @@ en: font_style: title: "Font style" header_description: "Customize the font styles used by your themes" + legal: + title: "Legal" + header_description: "Configure legal settings, such as terms of service, privacy policy, contact details, and EU-specific considerations" login_and_authentication: title: "Login and authentication" header_description: "Configure how users log in and authenticate, secrets and keys, OAuth2 providers, and more" @@ -5148,16 +5151,16 @@ en: header_description: "Customize the variations of your site logo" navigation: title: "Navigation" - header_description: "Configure the navigation links and menu items for your site. This includes the location and behaviour of the primary navigation menu, the quick links at the top of the homepage, as well as the admin sidebar." + header_description: "Configure the navigation links and menu items for your site. This includes the location and behaviour of the primary navigation menu, the quick links at the top of the homepage, as well as the admin sidebar" notifications: title: "Notifications" header_description: "Configure how notifications are managed and delivered for users, including email preferences, push notifications, mention limits, and notification consolidation" search: title: "Search" header_description: "Configure search settings including logging and tokenization for Chinese and Japanese languages" - legal: - title: "Legal" - header_description: "Configure legal settings, such as terms of service, privacy policy, contact details, and EU-specific considerations" + security: + title: "Security" + header_description: "Configure security settings, including two-factor authentication, moderator priviledges, and content security policies" trust_levels: title: "Trust levels" header_description: "Trust level settings allow you to fine-tune the requirements and notifications for your community’s progression system, which automatically promotes users to higher trust levels as they demonstrate consistent, positive engagement with your forum" diff --git a/config/routes.rb b/config/routes.rb index f0070be5170..e495356f70b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -394,12 +394,13 @@ Discourse::Application.routes.draw do resources :site_settings, only: %i[index] get "fonts" => "site_settings#index" + get "legal" => "site_settings#index" get "login-and-authentication" => "site_settings#index" get "logo" => "site_settings#index" get "navigation" => "site_settings#index" get "notifications" => "site_settings#index" get "search" => "site_settings#index" - get "legal" => "site_settings#index" + get "security" => "site_settings#index" get "experimental" => "site_settings#index" get "trust-levels" => "site_settings#index" get "group-permissions" => "site_settings#index"