diff options
author | Ana Krivokapic <akrivoka@redhat.com> | 2013-09-25 11:29:31 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2013-11-15 13:28:16 +0100 |
commit | b7c7eaf8d9d2a131c642ff9b2b0681047af5d1fe (patch) | |
tree | 8f7f3b16879e8d62ca39450039376a88cc00fea5 | |
parent | 6c9b3b02a4578f9985b343e4d6f716a7b829b8f0 (diff) | |
download | freeipa-b7c7eaf8d9d2a131c642ff9b2b0681047af5d1fe.tar.gz freeipa-b7c7eaf8d9d2a131c642ff9b2b0681047af5d1fe.tar.xz freeipa-b7c7eaf8d9d2a131c642ff9b2b0681047af5d1fe.zip |
Add automember rebuild command to the web UI
Design: http://www.freeipa.org/page/V3/Automember_rebuild_membership
https://fedorahosted.org/freeipa/ticket/3928
-rw-r--r-- | install/ui/src/freeipa/automember.js | 44 | ||||
-rw-r--r-- | install/ui/src/freeipa/host.js | 18 | ||||
-rw-r--r-- | install/ui/src/freeipa/user.js | 16 | ||||
-rw-r--r-- | install/ui/test/data/ipa_init.json | 10 | ||||
-rw-r--r-- | ipalib/plugins/internal.py | 10 |
5 files changed, 87 insertions, 11 deletions
diff --git a/install/ui/src/freeipa/automember.js b/install/ui/src/freeipa/automember.js index f8083b89e..2dff34227 100644 --- a/install/ui/src/freeipa/automember.js +++ b/install/ui/src/freeipa/automember.js @@ -699,12 +699,55 @@ IPA.automember.default_group_widget = function(spec) { return that; }; +IPA.automember.rebuild_action = function(spec) { + + spec = spec || {}; + spec.name = spec.name || 'automember_rebuild'; + spec.label = spec.label || '@i18n:actions.automember_rebuild'; + + var that = IPA.action(spec); + + that.execute_action = function(facet) { + var entity = facet.entity.name; + if (facet.name == 'search') { + var entries = facet.get_selected_values(); + } else { + entries = facet.get_pkeys(); + } + + var options = {}; + if (entries.length > 0) { + options[entity + 's'] = entries; + } else if (entity == 'user') { + options['type'] = 'group'; + } else { + options['type'] = 'hostgroup'; + } + + var command = IPA.command({ + entity: 'automember', + method: 'rebuild', + options: options, + on_success: function() { + IPA.notify_success('@i18n:actions.automember_rebuild_success'); + }, + on_error: function() { + } + }); + + command.execute(); + }; + + return that; +}; + exp.entity_spec = make_spec(); exp.register = function() { var e = reg.entity; var w = reg.widget; var f = reg.field; + var a = reg.action; e.register({ type: 'automember', @@ -713,6 +756,7 @@ exp.register = function() { }); w.register('automember_condition', IPA.automember.condition_widget); f.register('automember_condition', IPA.automember.condition_field); + a.register('automember_rebuild', exp.rebuild_action); }; phases.on('registration', exp.register); diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js index f5007538e..ff1e5da5b 100644 --- a/install/ui/src/freeipa/host.js +++ b/install/ui/src/freeipa/host.js @@ -63,7 +63,16 @@ return { label: '@i18n:objects.host.enrolled', formatter: 'boolean' } - ] + ], + actions: [ + 'select', + { + $type: 'automember_rebuild', + name: 'automember_rebuild', + label: '@i18n:actions.automember_rebuild' + } + ], + header_actions: ['select_action', 'automember_rebuild'] }, { $type: 'details', @@ -144,6 +153,12 @@ return { } ], actions: [ + 'select', + { + $type: 'automember_rebuild', + name: 'automember_rebuild', + label: '@i18n:actions.automember_rebuild' + }, 'host_unprovision', { $type: 'set_otp', @@ -165,6 +180,7 @@ return { 'cert_revoke', 'cert_restore' ], + header_actions: ['select_action', 'automember_rebuild'], state: { evaluators: [ IPA.host.has_password_evaluator, diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js index 61bdb43b4..d2ee3293f 100644 --- a/install/ui/src/freeipa/user.js +++ b/install/ui/src/freeipa/user.js @@ -67,6 +67,12 @@ return { 'title' ], actions: [ + 'select', + { + $type: 'automember_rebuild', + name: 'automember_rebuild', + label: '@i18n:actions.automember_rebuild' + }, { $type: 'batch_disable', hide_cond: ['self-service'] @@ -76,6 +82,7 @@ return { hide_cond: ['self-service'] } ], + header_actions: ['select_action', 'automember_rebuild'], control_buttons: [ { name: 'disable', @@ -240,9 +247,14 @@ return { 'enable', 'disable', 'delete', - 'reset_password' + 'reset_password', + { + $type: 'automember_rebuild', + name: 'automember_rebuild', + label: '@i18n:actions.automember_rebuild' + } ], - header_actions: ['select_action', 'enable', 'disable', 'delete'], + header_actions: ['select_action', 'enable', 'disable', 'delete', 'automember_rebuild'], state: { evaluators: [ { diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json index 8e0b2a33c..bac77962e 100644 --- a/install/ui/test/data/ipa_init.json +++ b/install/ui/test/data/ipa_init.json @@ -14,10 +14,12 @@ }, "actions": { "apply": "Apply", - "confirm": "Are you sure you want to proceed with the action.", - "delete_confirm": "Are you sure you want to delete ${object}", - "disable_confirm": "Are you sure you want to disable ${object}", - "enable_confirm": "Are you sure you want to enable ${object}", + "automember_rebuild": "Rebuild auto membership", + "automember_rebuild_success": "Automember rebuild membership task completed", + "confirm": "Are you sure you want to proceed with the action?", + "delete_confirm": "Are you sure you want to delete ${object}?", + "disable_confirm": "Are you sure you want to disable ${object}?", + "enable_confirm": "Are you sure you want to enable ${object}?", "title": "Actions" }, "association": { diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py index 83b505dae..049149127 100644 --- a/ipalib/plugins/internal.py +++ b/ipalib/plugins/internal.py @@ -149,10 +149,12 @@ class i18n_messages(Command): }, "actions": { "apply": _("Apply"), - "confirm": _("Are you sure you want to proceed with the action."), - "delete_confirm": _("Are you sure you want to delete ${object}"), - "disable_confirm": _("Are you sure you want to disable ${object}"), - "enable_confirm": _("Are you sure you want to enable ${object}"), + "automember_rebuild": _("Rebuild auto membership"), + "automember_rebuild_success": _("Automember rebuild membership task completed"), + "confirm": _("Are you sure you want to proceed with the action?"), + "delete_confirm": _("Are you sure you want to delete ${object}?"), + "disable_confirm": _("Are you sure you want to disable ${object}?"), + "enable_confirm": _("Are you sure you want to enable ${object}?"), "title": _("Actions"), }, "association": { |