On 06/02/2016 06:45 PM, Petr Vobornik wrote:
On 04/20/2016 07:05 PM, Pavel Vomacka wrote:
On 04/15/2016 06:44 PM, Petr Vobornik wrote:
On 04/13/2016 02:56 PM, Pavel Vomacka wrote:
Hello,
This patch adds ability to convert users from preserved to staged state.
Fixes this ticket:https://fedorahosted.org/freeipa/ticket/5371
--
Pavel^3 Vomacka
The patch requires rebase.
Attached rebased patches. I split this one patch into two patches.
Patch 13: ACK
Maybe a nitpick, why the icon have opacity 0.5?
I was not sure which icon I should use, so we talked about it with Honza
and we've chosen the the user icon which will be lighter than default.
It would be better to do it using text color. So, updated patch attached.
Patch 17: needs rebase
Rebased patch attached.
From fe5043f2ce4989c2a4149442ff23db6679bdf642 Mon Sep 17 00:00:00 2001
From: Pavel Vomacka <pvoma...@redhat.com>
Date: Wed, 20 Apr 2016 18:43:35 +0200
Subject: [PATCH 1/2] Add ability to stage multiple users
Add 'Stage' button on search page where preserved users are listed.
https://fedorahosted.org/freeipa/ticket/5371
---
install/ui/ipa.css | 4 ++++
install/ui/src/freeipa/stageuser.js | 29 +++++++++++++++++++++++++++++
install/ui/test/data/ipa_init.json | 3 +++
ipalib/plugins/internal.py | 3 +++
4 files changed, 39 insertions(+)
diff --git a/install/ui/ipa.css b/install/ui/ipa.css
index f419eb224252aa03eaf4b25bb03435f4c9a6de9b..2921f4360a70f143d936e39bfdd5693b4a341750 100644
--- a/install/ui/ipa.css
+++ b/install/ui/ipa.css
@@ -174,6 +174,10 @@ div[name=settings].facet-group li a {
float: right;
}
+.facet-controls-right .fa.fa-user {
+ color: #aaa;
+}
+
.control-buttons {
display: inline-block;
}
diff --git a/install/ui/src/freeipa/stageuser.js b/install/ui/src/freeipa/stageuser.js
index 9d26ef1fa1a86aef5835af51b7abd2369e4c7223..12debed301a3ddbc166abcb3f444dd4775b40407 100644
--- a/install/ui/src/freeipa/stageuser.js
+++ b/install/ui/src/freeipa/stageuser.js
@@ -298,6 +298,9 @@ stageuser.search_preserved_facet_spec = {
actions: [
{
$type: 'batch_undel'
+ },
+ {
+ $type: 'batch_stage'
}
],
control_buttons: [
@@ -305,6 +308,11 @@ stageuser.search_preserved_facet_spec = {
name: 'undel',
label: '@i18n:buttons.restore',
icon: 'fa-heart'
+ },
+ {
+ name: 'batch_stage',
+ label: '@i18n:buttons.stage',
+ icon: 'fa-user'
}
],
policies: [
@@ -323,6 +331,12 @@ mod_user.entity_spec.policies.push(
{
$factory: IPA.facet_update_policy,
source_facet: 'search_preserved',
+ dest_entity: 'stageuser',
+ dest_facet: 'search'
+ },
+ {
+ $factory: IPA.facet_update_policy,
+ source_facet: 'search_preserved',
dest_entity: 'user',
dest_facet: 'search'
},
@@ -385,6 +399,20 @@ stageuser.activate_action = function(spec) {
return that;
};
+stageuser.batch_stage_action = function(spec) {
+
+ spec = spec || {};
+
+ spec.name = spec.name || 'batch_stage';
+ spec.method = spec.method || 'stage';
+ spec.needs_confirm = spec.needs_confirm === undefined ? true : spec.needs_confirm;
+ spec.enable_cond = spec.enable_cond || ['item-selected'];
+ spec.success_msg = spec.success_msg || '@i18n:objects.stageuser.stage_success';
+ spec.confirm_msg = spec.confirm_msg || '@i18n:objects.stageuser.stage_confirm';
+
+ return IPA.batch_items_action(spec);
+};
+
/**
* Stage user entity specification object
* @member stageuser
@@ -402,6 +430,7 @@ stageuser.register = function() {
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_stage', stageuser.batch_stage_action);
e.register({type: 'stageuser', spec: stageuser.stageuser_spec});
f.register_from_spec('user_search_preserved', stageuser.search_preserved_facet_spec);
};
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 6ed7e98246c5d46850718fb1fbfafc0e8aebef0f..da401d415358347b5bb29fdbeaecf6da83546849 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -89,6 +89,7 @@
"save": "Save",
"set": "Set",
"show": "Show",
+ "stage": "Stage",
"unapply": "Un-apply",
"update": "Update",
"view": "View"
@@ -545,6 +546,8 @@
"activate_success": "${count} user(s) activated",
"label": "Stage users",
"preserved_label": "Preserved users",
+ "stage_confirm": "Are you sure you want to stage selected users?",
+ "stage_success": "${count} users(s) staged",
"undel_confirm": "Are you sure you want to restore selected users?",
"undel_success": "${count} user(s) restored",
"user_categories": "User categories",
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index 175063ba1e6d71d66ae9d5b0489c76e96af10685..073193c2a519627f0998f80f407a35ace218dac1 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -232,6 +232,7 @@ class i18n_messages(Command):
"save": _("Save"),
"set": _("Set"),
"show": _("Show"),
+ "stage": _("Stage"),
"unapply": ("Un-apply"),
"update": _("Update"),
"view": _("View"),
@@ -691,6 +692,8 @@ class i18n_messages(Command):
"activate_success": _("${count} user(s) activated"),
"label": _("Stage users"),
"preserved_label": _("Preserved users"),
+ "stage_confirm": _("Are you sure you want to stage selected users?"),
+ "stage_success": _("${count} users(s) staged"),
"undel_confirm": _("Are you sure you want to restore selected users?"),
"undel_success": _("${count} user(s) restored"),
"user_categories": _("User categories"),
--
2.5.5
From 942646460f4febbe3e82a1c3c824a925a4f1648b Mon Sep 17 00:00:00 2001
From: Pavel Vomacka <pvoma...@redhat.com>
Date: Wed, 20 Apr 2016 18:47:53 +0200
Subject: [PATCH 2/2] Add option to stage user from details page
Add 'stage' option to the activity dropdown menu on preserved user details page.
https://fedorahosted.org/freeipa/ticket/5371
---
install/ui/src/freeipa/stageuser.js | 24 ++++++++++++++++++++++++
install/ui/src/freeipa/user.js | 16 +++++++++++++---
install/ui/test/data/ipa_init.json | 1 +
ipalib/plugins/internal.py | 1 +
4 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/install/ui/src/freeipa/stageuser.js b/install/ui/src/freeipa/stageuser.js
index 12debed301a3ddbc166abcb3f444dd4775b40407..bd563847b9b2fb81180d6f2a24a3d1aa59661972 100644
--- a/install/ui/src/freeipa/stageuser.js
+++ b/install/ui/src/freeipa/stageuser.js
@@ -413,6 +413,29 @@ stageuser.batch_stage_action = function(spec) {
return IPA.batch_items_action(spec);
};
+stageuser.stage_action = function(spec) {
+
+ spec = spec || {};
+
+ spec.name = spec.name || 'stage';
+ spec.method = spec.method || 'stage';
+ spec.show_cond = spec.show_cond || ['preserved_user'];
+ spec.needs_confirm = spec.needs_confirm !== undefined ? spec.needs_confirm : true;
+ spec.confirm_msg = spec.confirm_msg || '@i18n:objects.stageuser.stage_one_confirm';
+ spec.label = spec.label || '@i18n:buttons.stage';
+
+ 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;
+};
+
/**
* Stage user entity specification object
* @member stageuser
@@ -431,6 +454,7 @@ stageuser.register = function() {
a.register('batch_undel', stageuser.batch_undel_action);
a.register('activate', stageuser.activate_action);
a.register('batch_stage', stageuser.batch_stage_action);
+ a.register('stage', stageuser.stage_action);
e.register({type: 'stageuser', spec: stageuser.stageuser_spec});
f.register_from_spec('user_search_preserved', stageuser.search_preserved_facet_spec);
};
diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js
index 22dfb6fcf16e64a7be55e0c7d0ebf9ba9cc64a3b..49c7ff4d45aab1749f2dcf88d5b97ef28e935857 100644
--- a/install/ui/src/freeipa/user.js
+++ b/install/ui/src/freeipa/user.js
@@ -67,6 +67,12 @@ return {
source_facet: 'details',
dest_entity: 'user',
dest_facet: 'search_preserved'
+ },
+ {
+ $factory: IPA.facet_update_policy,
+ source_facet: 'details',
+ dest_entity: 'stageuser',
+ dest_facet: 'search'
}
],
facets: [
@@ -344,6 +350,10 @@ return {
show_cond: ['preserved-user']
},
{
+ $type: 'stage',
+ show_cond: ['preserved-user']
+ },
+ {
$type: 'reset_password',
hide_cond: ['preserved-user']
},
@@ -368,9 +378,9 @@ return {
}
],
header_actions: [
- 'reset_password', 'enable', 'disable','delete_active_user',
- 'delete', 'unlock', 'add_otptoken', 'automember_rebuild',
- 'request_cert'
+ 'reset_password', 'enable', 'disable', 'stage',
+ 'delete_active_user', 'delete', 'unlock', 'add_otptoken',
+ 'automember_rebuild', 'request_cert'
],
state: {
evaluators: [
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index da401d415358347b5bb29fdbeaecf6da83546849..a8ec850a8c44925222e3787fea6f532a37634f76 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -548,6 +548,7 @@
"preserved_label": "Preserved users",
"stage_confirm": "Are you sure you want to stage selected users?",
"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_success": "${count} user(s) restored",
"user_categories": "User categories",
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index 073193c2a519627f0998f80f407a35ace218dac1..ac36f53541951787a710e52ce1d93fca764d5800 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -694,6 +694,7 @@ class i18n_messages(Command):
"preserved_label": _("Preserved users"),
"stage_confirm": _("Are you sure you want to stage selected users?"),
"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_success": _("${count} user(s) restored"),
"user_categories": _("User categories"),
--
2.5.5
--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code