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
This commit is contained in:
Endi Sukma Dewata
2012-01-18 21:54:41 -06:00
committed by Petr Voborník
parent fef343ae8f
commit b353239e59
11 changed files with 138 additions and 72 deletions

View File

@@ -43,8 +43,16 @@ IPA.dns.zone_entity = function(spec) {
that.builder.facet_groups([ 'dnsrecord', 'settings' ]). that.builder.facet_groups([ 'dnsrecord', 'settings' ]).
search_facet({ search_facet({
row_enabled_attribute: 'idnszoneactive',
title: IPA.metadata.objects.dnszone.label, title: IPA.metadata.objects.dnszone.label,
columns: [ 'idnsname' ] columns: [
'idnsname',
{
name: 'idnszoneactive',
label: IPA.messages.status.label,
format: IPA.boolean_status_format()
}
]
}). }).
details_facet({ details_facet({
factory: IPA.dnszone_details_facet, factory: IPA.dnszone_details_facet,
@@ -55,9 +63,10 @@ IPA.dns.zone_entity = function(spec) {
{ {
type: 'radio', type: 'radio',
name: 'idnszoneactive', name: 'idnszoneactive',
label: IPA.messages.status.label,
options: [ options: [
{ value: 'TRUE', label: IPA.get_message('true') }, { value: 'TRUE', label: IPA.messages.status.enabled },
{ value: 'FALSE', label: IPA.get_message('false') } { value: 'FALSE', label: IPA.messages.status.disabled }
] ]
}, },
'idnssoamname', 'idnssoamname',

View File

@@ -43,9 +43,8 @@ IPA.hbac.rule_entity = function(spec) {
'cn', 'cn',
{ {
name: 'ipaenabledflag', name: 'ipaenabledflag',
format: IPA.boolean_format({ label: IPA.messages.status.label,
show_false: true format: IPA.boolean_status_format()
})
}, },
'description' 'description'
] ]
@@ -208,6 +207,7 @@ IPA.hbacrule_details_facet = function(spec) {
{ {
type: 'enable', type: 'enable',
name: 'ipaenabledflag', name: 'ipaenabledflag',
label: IPA.messages.status.label,
priority: IPA.hbac.enable_priority, priority: IPA.hbac.enable_priority,
widget: 'general.ipaenabledflag' widget: 'general.ipaenabledflag'
} }
@@ -230,8 +230,8 @@ IPA.hbacrule_details_facet = function(spec) {
type: 'enable', type: 'enable',
name: 'ipaenabledflag', name: 'ipaenabledflag',
options: [ options: [
{ value: 'TRUE', label: IPA.get_message('true') }, { value: 'TRUE', label: IPA.messages.status.enabled },
{ value: 'FALSE', label: IPA.get_message('false') } { value: 'FALSE', label: IPA.messages.status.disabled }
] ]
} }
] ]

View File

@@ -50,13 +50,10 @@ IPA.hbac.test_entity = function(spec) {
'sn', 'sn',
{ {
name: 'nsaccountlock', name: 'nsaccountlock',
format: IPA.boolean_format({ label: IPA.messages.status.label,
true_value: IPA.messages.objects.user.active, format: IPA.boolean_status_format({
false_value: IPA.messages.objects.user.inactive, invert_value: true
invert_value: true, })
show_false: true
}),
label: IPA.messages.objects.user.account_status
} }
] ]
}). }).
@@ -118,9 +115,8 @@ IPA.hbac.test_entity = function(spec) {
'cn', 'cn',
{ {
name: 'ipaenabledflag', name: 'ipaenabledflag',
format: IPA.boolean_format({ label: IPA.messages.status.label,
show_false: true format: IPA.boolean_status_format()
})
}, },
'description' 'description'
] ]
@@ -142,9 +138,8 @@ IPA.hbac.test_entity = function(spec) {
}, },
{ {
name: 'ipaenabledflag', name: 'ipaenabledflag',
format: IPA.boolean_format({ label: IPA.messages.status.label,
show_false: true format: IPA.boolean_status_format()
})
}, },
'description' 'description'
] ]

View File

@@ -42,9 +42,8 @@ IPA.selinux.selinuxusermap_entity = function(spec) {
'ipaselinuxuser', 'ipaselinuxuser',
{ {
name: 'ipaenabledflag', name: 'ipaenabledflag',
format: IPA.boolean_format({ label: IPA.messages.status.label,
show_false: true format: IPA.boolean_status_format()
})
}, },
'description' 'description'
] ]
@@ -96,6 +95,7 @@ IPA.selinux_details_facet = function(spec) {
{ {
type: 'enable', type: 'enable',
name: 'ipaenabledflag', name: 'ipaenabledflag',
label: IPA.messages.status.label,
priority: IPA.selinux.enable_priority, priority: IPA.selinux.enable_priority,
widget: 'general.ipaenabledflag' widget: 'general.ipaenabledflag'
} }
@@ -128,8 +128,8 @@ IPA.selinux_details_facet = function(spec) {
type: 'enable', type: 'enable',
name: 'ipaenabledflag', name: 'ipaenabledflag',
options: [ options: [
{ value: 'TRUE', label: IPA.get_message('true') }, { value: 'TRUE', label: IPA.messages.status.enabled },
{ value: 'FALSE', label: IPA.get_message('false') } { value: 'FALSE', label: IPA.messages.status.disabled }
] ]
} }
] ]

View File

@@ -41,9 +41,8 @@ IPA.sudo.rule_entity = function(spec) {
'cn', 'cn',
{ {
name: 'ipaenabledflag', name: 'ipaenabledflag',
format: IPA.boolean_format({ label: IPA.messages.status.label,
show_false: true format: IPA.boolean_status_format()
})
}, },
'description' 'description'
] ]
@@ -206,6 +205,7 @@ IPA.sudorule_details_facet = function(spec) {
{ {
type: 'enable', type: 'enable',
name: 'ipaenabledflag', name: 'ipaenabledflag',
label: IPA.messages.status.label,
priority: IPA.sudo.enable_priority, priority: IPA.sudo.enable_priority,
widget: 'general.ipaenabledflag' widget: 'general.ipaenabledflag'
} }
@@ -228,8 +228,8 @@ IPA.sudorule_details_facet = function(spec) {
type: 'enable', type: 'enable',
name: 'ipaenabledflag', name: 'ipaenabledflag',
options: [ options: [
{ value: 'TRUE', label: IPA.get_message('true') }, { value: 'TRUE', label: IPA.messages.status.enabled },
{ value: 'FALSE', label: IPA.get_message('false') } { value: 'FALSE', label: IPA.messages.status.disabled }
] ]
} }
] ]

View File

@@ -15,6 +15,12 @@
"idnsname": [ "idnsname": [
"example.com" "example.com"
] ]
},
{
"dn": "idnsname=test.com,cn=dns,dc=example,dc=com",
"idnsname": [
"test.com"
]
} }
], ],
"summary": null, "summary": null,

View File

@@ -101,6 +101,55 @@
}, },
"summary": null, "summary": null,
"value": "example.com" "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"
} }
] ]
} }

View File

@@ -202,12 +202,10 @@
"posix": "Is this a POSIX group?" "posix": "Is this a POSIX group?"
}, },
"hbacrule": { "hbacrule": {
"active": "Active",
"any_host": "Any Host", "any_host": "Any Host",
"any_service": "Any Service", "any_service": "Any Service",
"anyone": "Anyone", "anyone": "Anyone",
"host": "Accessing", "host": "Accessing",
"inactive": "Inactive",
"ipaenabledflag": "Rule status", "ipaenabledflag": "Rule status",
"service": "Via Service", "service": "Via Service",
"sourcehost": "From", "sourcehost": "From",
@@ -310,7 +308,6 @@
"commands": "Commands" "commands": "Commands"
}, },
"sudorule": { "sudorule": {
"active": "Active",
"allow": "Allow", "allow": "Allow",
"any_command": "Any Command", "any_command": "Any Command",
"any_group": "Any Group", "any_group": "Any Group",
@@ -320,7 +317,6 @@
"deny": "Deny", "deny": "Deny",
"external": "External", "external": "External",
"host": "Access this host", "host": "Access this host",
"inactive": "Inactive",
"ipaenabledflag": "Rule status", "ipaenabledflag": "Rule status",
"options": "Options", "options": "Options",
"runas": "As Whom", "runas": "As Whom",
@@ -333,17 +329,13 @@
"user": { "user": {
"account": "Account Settings", "account": "Account Settings",
"account_status": "Account Status", "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", "contact": "Contact Settings",
"deactivate": "Deactivate",
"employee": "Employee Information", "employee": "Employee Information",
"error_changing_status": "Error changing account status", "error_changing_status": "Error changing account status",
"inactive": "Inactive",
"mailing": "Mailing Address", "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": { "password": {
@@ -363,6 +355,13 @@
"truncated": "Query returned more results than the configured size limit. Displaying the first ${counter} results.", "truncated": "Query returned more results than the configured size limit. Displaying the first ${counter} results.",
"unselect_all": "Unselect All" "unselect_all": "Unselect All"
}, },
"status": {
"disable": "Disable",
"disabled": "Disabled",
"enable": "Enable",
"enabled": "Enabled",
"label": "Status"
},
"tabs": { "tabs": {
"audit": "Audit", "audit": "Audit",
"automount": "Automount", "automount": "Automount",

View File

@@ -43,13 +43,10 @@ IPA.user.entity = function(spec) {
'sn', 'sn',
{ {
name: 'nsaccountlock', name: 'nsaccountlock',
format: IPA.boolean_format({ label: IPA.messages.status.label,
true_value: IPA.messages.objects.user.active, format: IPA.boolean_status_format({
false_value: IPA.messages.objects.user.inactive, invert_value: true
invert_value: true, })
show_false: true
}),
label: IPA.messages.objects.user.account_status
}, },
'uidnumber', 'uidnumber',
'mail', 'mail',
@@ -78,7 +75,7 @@ IPA.user.entity = function(spec) {
{ {
factory: IPA.user_status_widget, factory: IPA.user_status_widget,
name: 'nsaccountlock', name: 'nsaccountlock',
label: IPA.messages.objects.user.account_status label: IPA.messages.status.label
}, },
'uid', 'uid',
{ {
@@ -439,19 +436,19 @@ IPA.user_status_widget = function(spec) {
var action; var action;
if (locked) { if (locked) {
status = IPA.messages.objects.user.inactive; status = IPA.messages.status.disabled;
action = 'activate'; action = 'enable';
} else { } else {
status = IPA.messages.objects.user.active; status = IPA.messages.status.enabled;
action = 'deactivate'; action = 'disable';
} }
that.status_span.html(status); that.status_span.html(status);
that.status_link.attr('href', action); that.status_link.attr('href', action);
var message = IPA.messages.objects.user.activation_link; var message = IPA.messages.objects.user.status_link;
var action_label = IPA.messages.objects.user[action]; var action_label = IPA.messages.status[action];
message = message.replace('${action}', action_label); message = message.replace('${action}', action_label);
that.status_link.html(message); that.status_link.html(message);
@@ -473,12 +470,12 @@ IPA.user_status_widget = function(spec) {
var action = that.status_link.attr('href'); var action = that.status_link.attr('href');
var message = IPA.messages.objects.user.activation_confirmation; var message = IPA.messages.objects.user.status_confirmation;
var action_label = IPA.messages.objects.user[action]; var action_label = IPA.messages.status[action];
message = message.replace('${action}', action_label.toLocaleLowerCase()); message = message.replace('${action}', action_label.toLocaleLowerCase());
var dialog = IPA.dialog({ var dialog = IPA.dialog({
'title': IPA.messages.dialogs.confirmation title: IPA.messages.dialogs.confirmation
}); });
dialog.create = function() { dialog.create = function() {
@@ -490,7 +487,7 @@ IPA.user_status_widget = function(spec) {
label: action_label, label: action_label,
click: function() { click: function() {
that.set_status( that.set_status(
action == 'activate', action,
function(data, textStatus, xhr) { function(data, textStatus, xhr) {
var facet = that.entity.get_facet(); var facet = that.entity.get_facet();
facet.refresh(); facet.refresh();
@@ -511,10 +508,9 @@ IPA.user_status_widget = function(spec) {
dialog.open(that.container); 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 pkey = IPA.nav.get_state('user-pkey');
var method = enabled ? 'enable' : 'disable';
IPA.command({ IPA.command({
entity: 'user', entity: 'user',

View File

@@ -1019,6 +1019,19 @@ IPA.boolean_format = function(spec) {
return that; 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 The entity name must be set in the spec either directly or via entity.name
*/ */

View File

@@ -339,12 +339,10 @@ class i18n_messages(Command):
"posix": _("Is this a POSIX group?"), "posix": _("Is this a POSIX group?"),
}, },
"hbacrule": { "hbacrule": {
"active": _("Active"),
"any_host": _("Any Host"), "any_host": _("Any Host"),
"any_service": _("Any Service"), "any_service": _("Any Service"),
"anyone": _("Anyone"), "anyone": _("Anyone"),
"host": _("Accessing"), "host": _("Accessing"),
"inactive": _("Inactive"),
"ipaenabledflag": _("Rule status"), "ipaenabledflag": _("Rule status"),
"service": _("Via Service"), "service": _("Via Service"),
"sourcehost": _("From"), "sourcehost": _("From"),
@@ -449,7 +447,6 @@ class i18n_messages(Command):
"commands": _("Commands"), "commands": _("Commands"),
}, },
"sudorule": { "sudorule": {
"active": _("Active"),
"allow": _("Allow"), "allow": _("Allow"),
"any_command": _("Any Command"), "any_command": _("Any Command"),
"any_group": _("Any Group"), "any_group": _("Any Group"),
@@ -459,7 +456,6 @@ class i18n_messages(Command):
"deny": _("Deny"), "deny": _("Deny"),
"external": _("External"), "external": _("External"),
"host": _("Access this host"), "host": _("Access this host"),
"inactive": _("Inactive"),
"ipaenabledflag": _("Rule status"), "ipaenabledflag": _("Rule status"),
"options": _("Options"), "options": _("Options"),
"runas": _("As Whom"), "runas": _("As Whom"),
@@ -472,17 +468,13 @@ class i18n_messages(Command):
"user": { "user": {
"account": _("Account Settings"), "account": _("Account Settings"),
"account_status": _("Account Status"), "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"), "contact": _("Contact Settings"),
"deactivate": _("Deactivate"),
"employee": _("Employee Information"), "employee": _("Employee Information"),
"error_changing_status": _("Error changing account status"), "error_changing_status": _("Error changing account status"),
"inactive": _("Inactive"),
"mailing": _("Mailing Address"), "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": { "password": {
@@ -502,6 +494,13 @@ class i18n_messages(Command):
"truncated": _("Query returned more results than the configured size limit. Displaying the first ${counter} results."), "truncated": _("Query returned more results than the configured size limit. Displaying the first ${counter} results."),
"unselect_all": _("Unselect All"), "unselect_all": _("Unselect All"),
}, },
"status": {
"disable": _("Disable"),
"disabled": _("Disabled"),
"enable": _("Enable"),
"enabled": _("Enabled"),
"label": _("Status"),
},
"tabs": { "tabs": {
"audit": _("Audit"), "audit": _("Audit"),
"automount": _("Automount"), "automount": _("Automount"),