From aabe6f2bafec2077ddc3afb473bdb419136db836 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 23 Apr 2014 17:07:00 -0700 Subject: [PATCH] CLOUDSTACK-6487: UI > Add LDAP Account - fix a bug that a LDAP account that does not have email and all LDAP accounts below it are missing from the listing. --- ui/scripts/accounts.js | 1 + ui/scripts/ui-custom/accountsWizard.js | 95 ++++++++++++++++++++++++-- 2 files changed, 90 insertions(+), 6 deletions(-) diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js index ced9da0f0d5..935ba92ebec 100644 --- a/ui/scripts/accounts.js +++ b/ui/scripts/accounts.js @@ -97,6 +97,7 @@ label: 'Add LDAP Account', isHeader: true, preFilter: function(args) { + //if ((isAdmin() || isDomainAdmin()) && true) { //for testing only if ((isAdmin() || isDomainAdmin()) && isLdapEnabled()) { return true; } else { diff --git a/ui/scripts/ui-custom/accountsWizard.js b/ui/scripts/ui-custom/accountsWizard.js index 5ef0fa96b3a..3259227d137 100644 --- a/ui/scripts/ui-custom/accountsWizard.js +++ b/ui/scripts/ui-custom/accountsWizard.js @@ -130,6 +130,89 @@ dataType: "json", async: false, success: function(json) { + //for testing only (begin) + /* + json = { + "ldapuserresponse": { + "count": 11, + "LdapUser": [ + { + "email": "test@test.com", + "principal": "CN=Administrator,CN=Users,DC=hyd-qa,DC=com", + "username": "Administrator", + "domain": "CN=Administrator" + }, + { + "email": "test@test.com", + "principal": "CN=Guest,CN=Users,DC=hyd-qa,DC=com", + "username": "Guest", + "domain": "CN=Guest" + }, + { + "email": "test@test.com", + "principal": "CN=IUSR_HYD-QA12,CN=Users,DC=hyd-qa,DC=com", + "username": "IUSR_HYD-QA12", + "domain": "CN=IUSR_HYD-QA12" + }, + { + "email": "test@test.com", + "principal": "CN=IWAM_HYD-QA12,CN=Users,DC=hyd-qa,DC=com", + "username": "IWAM_HYD-QA12", + "domain": "CN=IWAM_HYD-QA12" + }, + { + "email": "test@test.com", + "principal": "CN=SUPPORT_388945a0,CN=Users,DC=hyd-qa,DC=com", + "username": "SUPPORT_388945a0", + "domain": "CN=SUPPORT_388945a0" + }, + { + "principal": "CN=jessica j,CN=Users,DC=hyd-qa,DC=com", + "firstname": "jessica", + "lastname": "j", + "username": "jessica", + "domain": "CN=jessica j" + }, + { + "principal": "CN=krbtgt,CN=Users,DC=hyd-qa,DC=com", + "username": "krbtgt", + "domain": "CN=krbtgt" + }, + { + "email": "sadhu@sadhu.com", + "principal": "CN=sadhu,CN=Users,DC=hyd-qa,DC=com", + "firstname": "sadhu", + "username": "sadhu", + "domain": "CN=sadhu" + }, + { + "email": "test@test.com", + "principal": "CN=sangee1 hariharan,CN=Users,DC=hyd-qa,DC=com", + "firstname": "sangee1", + "lastname": "hariharan", + "username": "sangee1", + "domain": "CN=sangee1 hariharan" + }, + { + "email": "test@test.com", + "principal": "CN=sanjeev n.,CN=Users,DC=hyd-qa,DC=com", + "firstname": "sanjeev", + "username": "sanjeev", + "domain": "CN=sanjeev n." + }, + { + "email": "test@test.com", + "principal": "CN=test1dddd,CN=Users,DC=hyd-qa,DC=com", + "firstname": "test1", + "username": "test1dddd", + "domain": "CN=test1dddd" + } + ] + } + }; + */ + //for testing only (end) + if (json.ldapuserresponse.count > 0) { $(json.ldapuserresponse.LdapUser).each(function() { var $result = $(''); @@ -137,15 +220,15 @@ $result.append( $('').addClass('select').append( $('').attr({ - type: 'checkbox', name: 'username', value: this.username + type: 'checkbox', name: 'username', value: _s(this.username) }) ), - $('').addClass('name').html(this.firstname + ' ' + this.lastname) - .attr('title', this.firstname + ' ' + this.lastname), - $('').addClass('username').html(this.username) + $('').addClass('name').html(_s(this.firstname) + ' ' + _s(this.lastname)) + .attr('title', _s(this.firstname) + ' ' + _s(this.lastname)), + $('').addClass('username').html(_s(this.username)) .attr('title', this.username), - $('').addClass('email').html(this.email) - .attr('title', this.email) + $('').addClass('email').html(_s(this.email)) + .attr('title', _s(this.email)) ) $table.append($result);