summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2012-01-05 09:10:11 -0600
committerPetr Vobornik <pvoborni@redhat.com>2012-01-06 15:25:43 +0100
commit2a00393712eb490b23604399ea8318b3b4cca118 (patch)
tree53af8579d526130441e018fa1e7a13de823e8b40 /install
parent1b1aad2b02e57988b2e91a29305bd45f2059b91a (diff)
downloadfreeipa-2a00393712eb490b23604399ea8318b3b4cca118.tar.gz
freeipa-2a00393712eb490b23604399ea8318b3b4cca118.tar.xz
freeipa-2a00393712eb490b23604399ea8318b3b4cca118.zip
Added account status into user search facet.
The user search facet has been modified to show the account status. The IPA.boolean_format has been converted into a class to allow behavior customization. Ticket #1996
Diffstat (limited to 'install')
-rw-r--r--install/ui/hbac.js2
-rw-r--r--install/ui/hbactest.js21
-rw-r--r--install/ui/host.js60
-rw-r--r--install/ui/rule.js2
-rw-r--r--install/ui/sudo.js2
-rw-r--r--install/ui/user.js9
-rw-r--r--install/ui/widget.js72
7 files changed, 120 insertions, 48 deletions
diff --git a/install/ui/hbac.js b/install/ui/hbac.js
index 2a18396aa..3346d0b01 100644
--- a/install/ui/hbac.js
+++ b/install/ui/hbac.js
@@ -42,7 +42,7 @@ IPA.hbac.rule_entity = function(spec) {
'cn',
{
name: 'ipaenabledflag',
- format: IPA.boolean_format
+ format: IPA.boolean_format()
},
'description'
]
diff --git a/install/ui/hbactest.js b/install/ui/hbactest.js
index 26aed6e00..26e8085d4 100644
--- a/install/ui/hbactest.js
+++ b/install/ui/hbactest.js
@@ -46,7 +46,16 @@ IPA.hbac.test_entity = function(spec) {
columns: [
'uid',
'givenname',
- 'sn'
+ 'sn',
+ {
+ name: 'nsaccountlock',
+ format: IPA.boolean_format({
+ true_value: IPA.messages.objects.user.active,
+ false_value: IPA.messages.objects.user.inactive,
+ invert_value: true
+ }),
+ label: IPA.messages.objects.user.account_status
+ }
]
}).
facet({
@@ -62,7 +71,7 @@ IPA.hbac.test_entity = function(spec) {
{
name: 'has_keytab',
label: IPA.messages.objects.host.enrolled,
- format: IPA.boolean_format
+ format: IPA.boolean_format()
}
]
}).
@@ -91,7 +100,7 @@ IPA.hbac.test_entity = function(spec) {
{
name: 'has_keytab',
label: IPA.messages.objects.host.enrolled,
- format: IPA.boolean_format
+ format: IPA.boolean_format()
}
]
}).
@@ -106,7 +115,7 @@ IPA.hbac.test_entity = function(spec) {
'cn',
{
name: 'ipaenabledflag',
- format: IPA.boolean_format
+ format: IPA.boolean_format()
},
'description'
]
@@ -123,11 +132,11 @@ IPA.hbac.test_entity = function(spec) {
{
name: 'matched',
label: IPA.messages.objects.hbactest.matched,
- format: IPA.boolean_format
+ format: IPA.boolean_format()
},
{
name: 'ipaenabledflag',
- format: IPA.boolean_format
+ format: IPA.boolean_format()
},
'description'
]
diff --git a/install/ui/host.js b/install/ui/host.js
index c23cd9965..90e6bde71 100644
--- a/install/ui/host.js
+++ b/install/ui/host.js
@@ -40,7 +40,7 @@ IPA.host.entity = function(spec) {
{
name: 'has_keytab',
label: IPA.messages.objects.host.enrolled,
- format: IPA.boolean_format
+ format: IPA.boolean_format()
}
]
}).
@@ -466,30 +466,42 @@ IPA.field_factories['host_dnsrecord_entity_link'] = IPA.host_dnsrecord_entity_li
IPA.widget_factories['host_dnsrecord_entity_link'] = IPA.link_widget;
/* Take an LDAP format date in UTC and format it */
-IPA.utc_date_column_format = function(value){
- if (!value) {
- return "";
- }
- if (value.length != "20101119025910Z".length){
- return value;
- }
- /* We only handle GMT */
- if (value.charAt(value.length -1) !== 'Z'){
- return value;
- }
+IPA.utc_date_column_format = function(spec) {
+
+ spec = spec || {};
+
+ var that = IPA.format(spec);
+
+ that.format = function(value) {
+
+ if (!value) return '';
+
+ // verify length
+ if (value.length != '20101119025910Z'.length) {
+ return value;
+ }
+
+ /* We only handle GMT */
+ if (value.charAt(value.length -1) !== 'Z') {
+ return value;
+ }
+
+ var date = new Date();
+
+ date.setUTCFullYear(
+ value.substring(0, 4), // YYYY
+ value.substring(4, 6)-1, // MM (0-11)
+ value.substring(6, 8)); // DD (1-31)
- var date = new Date();
-
- date.setUTCFullYear(
- value.substring(0, 4), // YYYY
- value.substring(4, 6)-1, // MM (0-11)
- value.substring(6, 8)); // DD (1-31)
- date.setUTCHours(
- value.substring(8, 10), // HH (0-23)
- value.substring(10, 12), // MM (0-59)
- value.substring(12, 14)); // SS (0-59)
- var formated = date.toString();
- return formated;
+ date.setUTCHours(
+ value.substring(8, 10), // HH (0-23)
+ value.substring(10, 12), // MM (0-59)
+ value.substring(12, 14)); // SS (0-59)
+
+ return date.toString();
+ };
+
+ return that;
};
diff --git a/install/ui/rule.js b/install/ui/rule.js
index e8be46ace..720df3c0f 100644
--- a/install/ui/rule.js
+++ b/install/ui/rule.js
@@ -122,7 +122,7 @@ IPA.rule_association_table_widget = function(spec) {
name: that.external,
label: IPA.messages.objects.sudorule.external,
entity: that.other_entity,
- format: IPA.boolean_format,
+ format: IPA.boolean_format(),
width: '200px'
});
}
diff --git a/install/ui/sudo.js b/install/ui/sudo.js
index eb51fd038..eb3569908 100644
--- a/install/ui/sudo.js
+++ b/install/ui/sudo.js
@@ -40,7 +40,7 @@ IPA.sudo.rule_entity = function(spec) {
'cn',
{
name: 'ipaenabledflag',
- format: IPA.boolean_format
+ format: IPA.boolean_format()
},
'description'
]
diff --git a/install/ui/user.js b/install/ui/user.js
index 879055edb..01d196cec 100644
--- a/install/ui/user.js
+++ b/install/ui/user.js
@@ -40,6 +40,15 @@ IPA.user.entity = function(spec) {
'uid',
'givenname',
'sn',
+ {
+ name: 'nsaccountlock',
+ format: IPA.boolean_format({
+ true_value: IPA.messages.objects.user.active,
+ false_value: IPA.messages.objects.user.inactive,
+ invert_value: true
+ }),
+ label: IPA.messages.objects.user.account_status
+ },
'uidnumber',
'mail',
'telephonenumber',
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 38646c998..9ae308ca2 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -927,25 +927,67 @@ IPA.textarea_widget = function (spec) {
return that;
};
-IPA.boolean_format = function(value) {
+IPA.format = function(spec) {
- if (value === undefined || value === null) return '';
+ spec = spec || {};
- if (value instanceof Array) {
- value = value[0];
- }
+ var that = {};
- var normalized_value = typeof value === 'string' ? value.toLowerCase() : '';
+ that.format = function(value) {
+ return value;
+ };
- if (value === false || normalized_value === 'false') {
- return IPA.messages['false'];
- }
+ return that;
+};
- if (value === true || normalized_value === 'true') {
- return IPA.messages['true'];
- }
+IPA.boolean_format = function(spec) {
+
+ spec = spec || {};
+
+ var that = IPA.format(spec);
+
+ that.true_value = spec.true_value || IPA.messages['true'];
+ that.false_value = spec.false_value || IPA.messages['false'];
+ that.show_false = spec.show_false;
+ that.invert_value = spec.invert_value;
+
+ that.format = function(value) {
+
+ if (value === undefined || value === null) return '';
+
+ if (value instanceof Array) {
+ value = value[0];
+ }
+
+ if (typeof value === 'string') {
+ value = value.toLowerCase();
+
+ if (value === 'true') {
+ value = true;
+ } else if (value === 'false') {
+ value = false;
+ } // leave other values unchanged
+ }
- return value;
+ if (typeof value === 'boolean') {
+ if (that.invert_value) value = !value;
+
+ if (value) {
+ value = that.true_value;
+
+ } else {
+ if (that.show_false) {
+ value = that.false_value;
+ } else {
+ value = '';
+ }
+ }
+ }
+
+ return value;
+ };
+
+ return that;
};
/*
@@ -978,8 +1020,8 @@ IPA.column = function (spec) {
container.empty();
var value = record[that.name];
- if (that.format && value) {
- value = that.format(value);
+ if (that.format) {
+ value = that.format.format(value);
}
value = value ? value.toString() : '';