summaryrefslogtreecommitdiffstats
path: root/install/ui/user.js
diff options
context:
space:
mode:
authorAlexander Bokovoy <abokovoy@redhat.com>2011-07-07 18:58:18 +0300
committerMartin Kosek <mkosek@redhat.com>2011-07-13 12:02:46 +0200
commitb93e0b8bbfaa1e9252b3d096ef9251493654dec2 (patch)
treee261bcb0bfdccf12be4a152b55eb8ff341b9d542 /install/ui/user.js
parentf534445e26ebfca38afe1c834ba088cbcbc24e37 (diff)
downloadfreeipa-b93e0b8bbfaa1e9252b3d096ef9251493654dec2.tar.gz
freeipa-b93e0b8bbfaa1e9252b3d096ef9251493654dec2.tar.xz
freeipa-b93e0b8bbfaa1e9252b3d096ef9251493654dec2.zip
Convert nsaccountlock to always work as bool towards Python code
https://fedorahosted.org/freeipa/ticket/1259 Python code will see nsaccountlock as bool. JavaScript code will also see it as bool. This allows native boolean operations with the lock field. Passes both CLI and WebUI tests.
Diffstat (limited to 'install/ui/user.js')
-rw-r--r--install/ui/user.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/install/ui/user.js b/install/ui/user.js
index 9fd14d69d..fb43916f1 100644
--- a/install/ui/user.js
+++ b/install/ui/user.js
@@ -200,9 +200,16 @@ IPA.user_status_widget = function(spec) {
if (!that.record) return;
var lock_field = 'nsaccountlock';
+ var locked_field = that.record[lock_field];
+ var locked = false;
- var locked = that.record[lock_field] &&
- that.record[lock_field][0].toLowerCase() === 'true';
+ if (typeof locked_field === 'array') locked_field = locked_field[0];
+
+ if (typeof locked_field === 'boolean') {
+ locked = locked_field;
+ } else {
+ locked = locked_field && locked_field.toLowerCase() === 'true';
+ }
var status;
var action;