From abe2dd0796e77eafca439f35e61ae743b7ac4b16 Mon Sep 17 00:00:00 2001 From: Serhii Tsymbaliuk Date: Wed, 13 May 2020 15:54:17 +0200 Subject: [PATCH] WebUI: Add confirmation dialog for changing default user/host group Changing default group on automember rules page is too easy. Add a confirmation dialog to avoid misclick in the case. Ticket: https://pagure.io/freeipa/issue/8322 Signed-off-by: Serhii Tsymbaliuk Reviewed-By: Florence Blanc-Renaud --- install/ui/src/freeipa/automember.js | 21 ++++++++++++++++----- ipaserver/plugins/internal.py | 3 +++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/install/ui/src/freeipa/automember.js b/install/ui/src/freeipa/automember.js index a1d56a1b15244d81506c20284bb8341ab5e30d59..7223d0fa9a283a28dc985526375744805dc4f8b2 100644 --- a/install/ui/src/freeipa/automember.js +++ b/install/ui/src/freeipa/automember.js @@ -594,11 +594,22 @@ IPA.automember.default_group_widget = function(spec) { if (group === that.group) return; - if (group === '') { - that.remove_default_group(); - } else { - that.set_default_group(group); - } + var dialog = IPA.confirm_dialog({ + title: that.get_title(), + message: text.get('@i18n:objects.automember.default_group_confirm'), + on_ok: function() { + if (group === '') { + that.remove_default_group(); + } else { + that.set_default_group(group); + } + }, + on_cancel: function() { + that.group_select.update([that.group]); + } + }); + + dialog.open(); }; that.load = function(data) { diff --git a/ipaserver/plugins/internal.py b/ipaserver/plugins/internal.py index c293e0b5e06677f09daa4b820ffd06a2671cd6e1..8588a7198c7def6727ba33d0b80b9e0be5cae701 100644 --- a/ipaserver/plugins/internal.py +++ b/ipaserver/plugins/internal.py @@ -363,6 +363,9 @@ class i18n_messages(Command): "add_condition": _("Add Condition into ${pkey}"), "add_rule": _("Add Rule"), "attribute": _("Attribute"), + "default_group_confirm": _( + "Are you sure you want to change default group?" + ), "default_host_group": _("Default host group"), "default_user_group": _("Default user group"), "exclusive": _("Exclusive"), -- 2.34.3