summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Vomacka <pvomacka@redhat.com>2016-08-22 14:45:14 +0200
committerMartin Babinsky <mbabinsk@redhat.com>2016-09-08 09:44:20 +0200
commitc3374c6e16a10e8780401c58c04dcf8d95ea1a4d (patch)
tree18a52918bdf8197308ab79d9ad6a40ff20e16aab
parentb232ad463cf43596cdf397e51469df13a89e83fa (diff)
downloadfreeipa-c3374c6e16a10e8780401c58c04dcf8d95ea1a4d.tar.gz
freeipa-c3374c6e16a10e8780401c58c04dcf8d95ea1a4d.tar.xz
freeipa-c3374c6e16a10e8780401c58c04dcf8d95ea1a4d.zip
Add 'Restore' option to action dropdown menu
Also moving activate_action method several lines up - correcting logical order of methods. https://fedorahosted.org/freeipa/ticket/5818 Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
-rw-r--r--install/ui/src/freeipa/stageuser.js37
-rw-r--r--install/ui/src/freeipa/user.js6
-rw-r--r--install/ui/test/data/ipa_init.json1
-rw-r--r--ipaserver/plugins/internal.py1
4 files changed, 36 insertions, 9 deletions
diff --git a/install/ui/src/freeipa/stageuser.js b/install/ui/src/freeipa/stageuser.js
index bd563847b..bf244914e 100644
--- a/install/ui/src/freeipa/stageuser.js
+++ b/install/ui/src/freeipa/stageuser.js
@@ -364,6 +364,26 @@ stageuser.batch_activate_action = function(spec) {
return IPA.batch_items_action(spec);
};
+stageuser.activate_action = function(spec) {
+ spec = spec || {};
+ spec.name = spec.name || 'activate';
+ spec.method = spec.method || 'activate';
+ spec.needs_confirm = spec.needs_confirm !== undefined ? spec.needs_confirm : true;
+ spec.confirm_msg = spec.confirm_msg || '@i18n:objects.stageuser.activate_one_confirm';
+ spec.label = spec.label || '@i18n:buttons.activate';
+
+ var that = IPA.object_action(spec);
+
+ that.on_success = function(facet, data, text_status, xhr) {
+
+ IPA.notify_success(data.result.summary);
+ facet.on_update.notify();
+ facet.redirect();
+ };
+
+ return that;
+};
+
stageuser.batch_undel_action = function(spec) {
spec = spec || {};
@@ -379,18 +399,18 @@ stageuser.batch_undel_action = function(spec) {
return IPA.batch_items_action(spec);
};
-stageuser.activate_action = function(spec) {
+stageuser.undel_action = function(spec) {
spec = spec || {};
- spec.name = spec.name || 'activate';
- spec.method = spec.method || 'activate';
- spec.needs_confirm = spec.needs_confirm !== undefined ? spec.needs_confirm : true;
- spec.confirm_msg = spec.confirm_msg || '@i18n:objects.stageuser.activate_one_confirm';
- spec.label = spec.label || '@i18n:buttons.activate';
+
+ spec.name = spec.name || 'undel';
+ spec.method = spec.method || 'undel';
+ spec.needs_confirm = spec.needs_confirm === undefined ? true : spec.needs_confirm;
+ spec.confirm_msg = spec.confirm_msg || '@i18n:objects.stageuser.undel_one_confirm';
+ spec.label = spec.label || '@i18n:buttons.restore';
var that = IPA.object_action(spec);
that.on_success = function(facet, data, text_status, xhr) {
-
IPA.notify_success(data.result.summary);
facet.on_update.notify();
facet.redirect();
@@ -451,8 +471,9 @@ stageuser.register = function() {
var e = reg.entity;
var f = reg.facet;
a.register('batch_activate', stageuser.batch_activate_action);
- a.register('batch_undel', stageuser.batch_undel_action);
a.register('activate', stageuser.activate_action);
+ a.register('batch_undel', stageuser.batch_undel_action);
+ a.register('undel', stageuser.undel_action);
a.register('batch_stage', stageuser.batch_stage_action);
a.register('stage', stageuser.stage_action);
e.register({type: 'stageuser', spec: stageuser.stageuser_spec});
diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js
index 0bebf443a..e3eda509f 100644
--- a/install/ui/src/freeipa/user.js
+++ b/install/ui/src/freeipa/user.js
@@ -373,6 +373,10 @@ return {
show_cond: ['preserved-user']
},
{
+ $type: 'undel',
+ show_cond: ['preserved-user']
+ },
+ {
$type: 'stage',
show_cond: ['preserved-user']
},
@@ -401,7 +405,7 @@ return {
}
],
header_actions: [
- 'reset_password', 'enable', 'disable', 'stage',
+ 'reset_password', 'enable', 'disable', 'stage', 'undel',
'delete_active_user', 'delete', 'unlock', 'add_otptoken',
'automember_rebuild', 'request_cert'
],
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index efaf6b649..6903f927a 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -592,6 +592,7 @@
"stage_success": "${count} users(s) staged",
"stage_one_confirm": "Are you sure you want to stage ${object}?",
"undel_confirm": "Are you sure you want to restore selected users?",
+ "undel_one_confirm": "Are you sure you want to restore ${object}?",
"undel_success": "${count} user(s) restored",
"user_categories": "User categories",
},
diff --git a/ipaserver/plugins/internal.py b/ipaserver/plugins/internal.py
index 8af0af76c..c2819aa8a 100644
--- a/ipaserver/plugins/internal.py
+++ b/ipaserver/plugins/internal.py
@@ -744,6 +744,7 @@ class i18n_messages(Command):
"stage_success": _("${count} users(s) staged"),
"stage_one_confirm": _("Are you sure you want to stage ${object}?"),
"undel_confirm": _("Are you sure you want to restore selected users?"),
+ "undel_one_confirm": _("Are you sure you want to restore ${object}?"),
"undel_success": _("${count} user(s) restored"),
"user_categories": _("User categories"),
},