diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-01-18 21:54:41 -0600 |
---|---|---|
committer | Petr VobornÃk <pvoborni@redhat.com> | 2012-01-23 15:38:41 +0100 |
commit | b353239e59a8eb32fb1ac66e29228dc95b74e4e6 (patch) | |
tree | 09093bfd4ae3a5954c680998000635c15165c91f | |
parent | fef343ae8f501aa67d4c746d9c7103d797fd6be2 (diff) | |
download | freeipa-b353239e59a8eb32fb1ac66e29228dc95b74e4e6.tar.gz freeipa-b353239e59a8eb32fb1ac66e29228dc95b74e4e6.tar.xz freeipa-b353239e59a8eb32fb1ac66e29228dc95b74e4e6.zip |
Fixed inconsistent status labels.
This patch modifies the status attributes in users, DNS zones,
HBAC/sudo rules, HBAC test, and SELinux User Map to use the same
label (i.e. Status) and values (i.e. Enabled/Disabled). The method
to change the status will be modified separately.
Ticket #2247
-rw-r--r-- | install/ui/dns.js | 15 | ||||
-rw-r--r-- | install/ui/hbac.js | 10 | ||||
-rw-r--r-- | install/ui/hbactest.js | 21 | ||||
-rw-r--r-- | install/ui/selinux.js | 10 | ||||
-rw-r--r-- | install/ui/sudo.js | 10 | ||||
-rw-r--r-- | install/ui/test/data/dnszone_find_pkeys.json | 6 | ||||
-rw-r--r-- | install/ui/test/data/dnszone_get_records.json | 49 | ||||
-rw-r--r-- | install/ui/test/data/ipa_init.json | 21 | ||||
-rw-r--r-- | install/ui/user.js | 36 | ||||
-rw-r--r-- | install/ui/widget.js | 13 | ||||
-rw-r--r-- | ipalib/plugins/internal.py | 19 |
11 files changed, 138 insertions, 72 deletions
diff --git a/install/ui/dns.js b/install/ui/dns.js index 6383d922..d23eca3a 100644 --- a/install/ui/dns.js +++ b/install/ui/dns.js @@ -43,8 +43,16 @@ IPA.dns.zone_entity = function(spec) { that.builder.facet_groups([ 'dnsrecord', 'settings' ]). search_facet({ + row_enabled_attribute: 'idnszoneactive', title: IPA.metadata.objects.dnszone.label, - columns: [ 'idnsname' ] + columns: [ + 'idnsname', + { + name: 'idnszoneactive', + label: IPA.messages.status.label, + format: IPA.boolean_status_format() + } + ] }). details_facet({ factory: IPA.dnszone_details_facet, @@ -55,9 +63,10 @@ IPA.dns.zone_entity = function(spec) { { type: 'radio', name: 'idnszoneactive', + label: IPA.messages.status.label, options: [ - { value: 'TRUE', label: IPA.get_message('true') }, - { value: 'FALSE', label: IPA.get_message('false') } + { value: 'TRUE', label: IPA.messages.status.enabled }, + { value: 'FALSE', label: IPA.messages.status.disabled } ] }, 'idnssoamname', diff --git a/install/ui/hbac.js b/install/ui/hbac.js index 5d6de15d..bff2af30 100644 --- a/install/ui/hbac.js +++ b/install/ui/hbac.js @@ -43,9 +43,8 @@ IPA.hbac.rule_entity = function(spec) { 'cn', { name: 'ipaenabledflag', - format: IPA.boolean_format({ - show_false: true - }) + label: IPA.messages.status.label, + format: IPA.boolean_status_format() }, 'description' ] @@ -208,6 +207,7 @@ IPA.hbacrule_details_facet = function(spec) { { type: 'enable', name: 'ipaenabledflag', + label: IPA.messages.status.label, priority: IPA.hbac.enable_priority, widget: 'general.ipaenabledflag' } @@ -230,8 +230,8 @@ IPA.hbacrule_details_facet = function(spec) { type: 'enable', name: 'ipaenabledflag', options: [ - { value: 'TRUE', label: IPA.get_message('true') }, - { value: 'FALSE', label: IPA.get_message('false') } + { value: 'TRUE', label: IPA.messages.status.enabled }, + { value: 'FALSE', label: IPA.messages.status.disabled } ] } ] diff --git a/install/ui/hbactest.js b/install/ui/hbactest.js index b529a1d5..e9b02a14 100644 --- a/install/ui/hbactest.js +++ b/install/ui/hbactest.js @@ -50,13 +50,10 @@ IPA.hbac.test_entity = function(spec) { 'sn', { name: 'nsaccountlock', - format: IPA.boolean_format({ - true_value: IPA.messages.objects.user.active, - false_value: IPA.messages.objects.user.inactive, - invert_value: true, - show_false: true - }), - label: IPA.messages.objects.user.account_status + label: IPA.messages.status.label, + format: IPA.boolean_status_format({ + invert_value: true + }) } ] }). @@ -118,9 +115,8 @@ IPA.hbac.test_entity = function(spec) { 'cn', { name: 'ipaenabledflag', - format: IPA.boolean_format({ - show_false: true - }) + label: IPA.messages.status.label, + format: IPA.boolean_status_format() }, 'description' ] @@ -142,9 +138,8 @@ IPA.hbac.test_entity = function(spec) { }, { name: 'ipaenabledflag', - format: IPA.boolean_format({ - show_false: true - }) + label: IPA.messages.status.label, + format: IPA.boolean_status_format() }, 'description' ] diff --git a/install/ui/selinux.js b/install/ui/selinux.js index 1ca11760..050659a6 100644 --- a/install/ui/selinux.js +++ b/install/ui/selinux.js @@ -42,9 +42,8 @@ IPA.selinux.selinuxusermap_entity = function(spec) { 'ipaselinuxuser', { name: 'ipaenabledflag', - format: IPA.boolean_format({ - show_false: true - }) + label: IPA.messages.status.label, + format: IPA.boolean_status_format() }, 'description' ] @@ -96,6 +95,7 @@ IPA.selinux_details_facet = function(spec) { { type: 'enable', name: 'ipaenabledflag', + label: IPA.messages.status.label, priority: IPA.selinux.enable_priority, widget: 'general.ipaenabledflag' } @@ -128,8 +128,8 @@ IPA.selinux_details_facet = function(spec) { type: 'enable', name: 'ipaenabledflag', options: [ - { value: 'TRUE', label: IPA.get_message('true') }, - { value: 'FALSE', label: IPA.get_message('false') } + { value: 'TRUE', label: IPA.messages.status.enabled }, + { value: 'FALSE', label: IPA.messages.status.disabled } ] } ] diff --git a/install/ui/sudo.js b/install/ui/sudo.js index f1b64bd5..78af5fce 100644 --- a/install/ui/sudo.js +++ b/install/ui/sudo.js @@ -41,9 +41,8 @@ IPA.sudo.rule_entity = function(spec) { 'cn', { name: 'ipaenabledflag', - format: IPA.boolean_format({ - show_false: true - }) + label: IPA.messages.status.label, + format: IPA.boolean_status_format() }, 'description' ] @@ -206,6 +205,7 @@ IPA.sudorule_details_facet = function(spec) { { type: 'enable', name: 'ipaenabledflag', + label: IPA.messages.status.label, priority: IPA.sudo.enable_priority, widget: 'general.ipaenabledflag' } @@ -228,8 +228,8 @@ IPA.sudorule_details_facet = function(spec) { type: 'enable', name: 'ipaenabledflag', options: [ - { value: 'TRUE', label: IPA.get_message('true') }, - { value: 'FALSE', label: IPA.get_message('false') } + { value: 'TRUE', label: IPA.messages.status.enabled }, + { value: 'FALSE', label: IPA.messages.status.disabled } ] } ] diff --git a/install/ui/test/data/dnszone_find_pkeys.json b/install/ui/test/data/dnszone_find_pkeys.json index f40636f4..8f642cce 100644 --- a/install/ui/test/data/dnszone_find_pkeys.json +++ b/install/ui/test/data/dnszone_find_pkeys.json @@ -15,6 +15,12 @@ "idnsname": [ "example.com" ] + }, + { + "dn": "idnsname=test.com,cn=dns,dc=example,dc=com", + "idnsname": [ + "test.com" + ] } ], "summary": null, diff --git a/install/ui/test/data/dnszone_get_records.json b/install/ui/test/data/dnszone_get_records.json index 2e14716c..d1d20bf0 100644 --- a/install/ui/test/data/dnszone_get_records.json +++ b/install/ui/test/data/dnszone_get_records.json @@ -101,6 +101,55 @@ }, "summary": null, "value": "example.com" + }, + { + "error": null, + "result": { + "dn": "idnsname=test.com,cn=dns,dc=example,dc=com", + "idnsallowdynupdate": [ + "TRUE" + ], + "idnsname": [ + "test.com" + ], + "idnssoaexpire": [ + "1209600" + ], + "idnssoaminimum": [ + "3600" + ], + "idnssoamname": [ + "dev.example.com." + ], + "idnssoarefresh": [ + "3600" + ], + "idnssoaretry": [ + "900" + ], + "idnssoarname": [ + "root.dev.example.com." + ], + "idnssoaserial": [ + "2010021201" + ], + "idnsupdatepolicy": [ + "grant TEST.COM krb5-self * A;" + ], + "idnszoneactive": [ + "FALSE" + ], + "nsrecord": [ + "dev.example.com." + ], + "objectclass": [ + "top", + "idnsrecord", + "idnszone" + ] + }, + "summary": null, + "value": "test.com" } ] } diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json index a0738734..b819c30b 100644 --- a/install/ui/test/data/ipa_init.json +++ b/install/ui/test/data/ipa_init.json @@ -202,12 +202,10 @@ "posix": "Is this a POSIX group?" }, "hbacrule": { - "active": "Active", "any_host": "Any Host", "any_service": "Any Service", "anyone": "Anyone", "host": "Accessing", - "inactive": "Inactive", "ipaenabledflag": "Rule status", "service": "Via Service", "sourcehost": "From", @@ -310,7 +308,6 @@ "commands": "Commands" }, "sudorule": { - "active": "Active", "allow": "Allow", "any_command": "Any Command", "any_group": "Any Group", @@ -320,7 +317,6 @@ "deny": "Deny", "external": "External", "host": "Access this host", - "inactive": "Inactive", "ipaenabledflag": "Rule status", "options": "Options", "runas": "As Whom", @@ -333,17 +329,13 @@ "user": { "account": "Account Settings", "account_status": "Account Status", - "activate": "Activate", - "activation_confirmation": "Are you sure you want to ${action} the user?<br/>The change will take effect immediately.", - "activation_link": "Click to ${action}", - "active": "Active", "contact": "Contact Settings", - "deactivate": "Deactivate", "employee": "Employee Information", "error_changing_status": "Error changing account status", - "inactive": "Inactive", "mailing": "Mailing Address", - "misc": "Misc. Information" + "misc": "Misc. Information", + "status_confirmation": "Are you sure you want to ${action} the user?<br/>The change will take effect immediately.", + "status_link": "Click to ${action}" } }, "password": { @@ -363,6 +355,13 @@ "truncated": "Query returned more results than the configured size limit. Displaying the first ${counter} results.", "unselect_all": "Unselect All" }, + "status": { + "disable": "Disable", + "disabled": "Disabled", + "enable": "Enable", + "enabled": "Enabled", + "label": "Status" + }, "tabs": { "audit": "Audit", "automount": "Automount", diff --git a/install/ui/user.js b/install/ui/user.js index 92ac86a8..2466b880 100644 --- a/install/ui/user.js +++ b/install/ui/user.js @@ -43,13 +43,10 @@ IPA.user.entity = function(spec) { 'sn', { name: 'nsaccountlock', - format: IPA.boolean_format({ - true_value: IPA.messages.objects.user.active, - false_value: IPA.messages.objects.user.inactive, - invert_value: true, - show_false: true - }), - label: IPA.messages.objects.user.account_status + label: IPA.messages.status.label, + format: IPA.boolean_status_format({ + invert_value: true + }) }, 'uidnumber', 'mail', @@ -78,7 +75,7 @@ IPA.user.entity = function(spec) { { factory: IPA.user_status_widget, name: 'nsaccountlock', - label: IPA.messages.objects.user.account_status + label: IPA.messages.status.label }, 'uid', { @@ -439,19 +436,19 @@ IPA.user_status_widget = function(spec) { var action; if (locked) { - status = IPA.messages.objects.user.inactive; - action = 'activate'; + status = IPA.messages.status.disabled; + action = 'enable'; } else { - status = IPA.messages.objects.user.active; - action = 'deactivate'; + status = IPA.messages.status.enabled; + action = 'disable'; } that.status_span.html(status); that.status_link.attr('href', action); - var message = IPA.messages.objects.user.activation_link; - var action_label = IPA.messages.objects.user[action]; + var message = IPA.messages.objects.user.status_link; + var action_label = IPA.messages.status[action]; message = message.replace('${action}', action_label); that.status_link.html(message); @@ -473,12 +470,12 @@ IPA.user_status_widget = function(spec) { var action = that.status_link.attr('href'); - var message = IPA.messages.objects.user.activation_confirmation; - var action_label = IPA.messages.objects.user[action]; + var message = IPA.messages.objects.user.status_confirmation; + var action_label = IPA.messages.status[action]; message = message.replace('${action}', action_label.toLocaleLowerCase()); var dialog = IPA.dialog({ - 'title': IPA.messages.dialogs.confirmation + title: IPA.messages.dialogs.confirmation }); dialog.create = function() { @@ -490,7 +487,7 @@ IPA.user_status_widget = function(spec) { label: action_label, click: function() { that.set_status( - action == 'activate', + action, function(data, textStatus, xhr) { var facet = that.entity.get_facet(); facet.refresh(); @@ -511,10 +508,9 @@ IPA.user_status_widget = function(spec) { dialog.open(that.container); }; - that.set_status = function(enabled, on_success, on_error) { + that.set_status = function(method, on_success, on_error) { var pkey = IPA.nav.get_state('user-pkey'); - var method = enabled ? 'enable' : 'disable'; IPA.command({ entity: 'user', diff --git a/install/ui/widget.js b/install/ui/widget.js index 85d9282c..a7dd81e6 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -1019,6 +1019,19 @@ IPA.boolean_format = function(spec) { return that; }; +IPA.boolean_status_format = function(spec) { + + spec = spec || {}; + + var that = IPA.boolean_format(spec); + + that.true_value = spec.true_value || IPA.messages.status.enabled; + that.false_value = spec.false_value || IPA.messages.status.disabled; + that.show_false = true; + + return that; +}; + /* The entity name must be set in the spec either directly or via entity.name */ diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py index 94be9107..05fb9687 100644 --- a/ipalib/plugins/internal.py +++ b/ipalib/plugins/internal.py @@ -339,12 +339,10 @@ class i18n_messages(Command): "posix": _("Is this a POSIX group?"), }, "hbacrule": { - "active": _("Active"), "any_host": _("Any Host"), "any_service": _("Any Service"), "anyone": _("Anyone"), "host": _("Accessing"), - "inactive": _("Inactive"), "ipaenabledflag": _("Rule status"), "service": _("Via Service"), "sourcehost": _("From"), @@ -449,7 +447,6 @@ class i18n_messages(Command): "commands": _("Commands"), }, "sudorule": { - "active": _("Active"), "allow": _("Allow"), "any_command": _("Any Command"), "any_group": _("Any Group"), @@ -459,7 +456,6 @@ class i18n_messages(Command): "deny": _("Deny"), "external": _("External"), "host": _("Access this host"), - "inactive": _("Inactive"), "ipaenabledflag": _("Rule status"), "options": _("Options"), "runas": _("As Whom"), @@ -472,17 +468,13 @@ class i18n_messages(Command): "user": { "account": _("Account Settings"), "account_status": _("Account Status"), - "activate": _("Activate"), - "activation_confirmation": _("Are you sure you want to ${action} the user?<br/>The change will take effect immediately."), - "activation_link": _("Click to ${action}"), - "active": _("Active"), "contact": _("Contact Settings"), - "deactivate": _("Deactivate"), "employee": _("Employee Information"), "error_changing_status": _("Error changing account status"), - "inactive": _("Inactive"), "mailing": _("Mailing Address"), "misc": _("Misc. Information"), + "status_confirmation": _("Are you sure you want to ${action} the user?<br/>The change will take effect immediately."), + "status_link": _("Click to ${action}"), }, }, "password": { @@ -502,6 +494,13 @@ class i18n_messages(Command): "truncated": _("Query returned more results than the configured size limit. Displaying the first ${counter} results."), "unselect_all": _("Unselect All"), }, + "status": { + "disable": _("Disable"), + "disabled": _("Disabled"), + "enable": _("Enable"), + "enabled": _("Enabled"), + "label": _("Status"), + }, "tabs": { "audit": _("Audit"), "automount": _("Automount"), |