Repository: cloudstack Updated Branches: refs/heads/master 58d913c25 -> d7291e520
CLOUDSTACK-6379: UI > fix a bug that domain admin failed to be created when current login doesn't have visibility to root domain object. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d7291e52 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d7291e52 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d7291e52 Branch: refs/heads/master Commit: d7291e520054c0f6c70bf5feca00b7ff727779b2 Parents: 58d913c Author: Jessica Wang <[email protected]> Authored: Mon May 12 15:33:40 2014 -0700 Committer: Jessica Wang <[email protected]> Committed: Mon May 12 15:37:42 2014 -0700 ---------------------------------------------------------------------- ui/scripts/accounts.js | 3 +- ui/scripts/accountsWizard.js | 67 ++++++--------------------------------- 2 files changed, 10 insertions(+), 60 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d7291e52/ui/scripts/accounts.js ---------------------------------------------------------------------- diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js index 935ba92..4eaa401 100644 --- a/ui/scripts/accounts.js +++ b/ui/scripts/accounts.js @@ -17,8 +17,7 @@ (function(cloudStack) { var domainObjs; - var rootDomainId; - + cloudStack.sections.accounts = { title: 'label.accounts', id: 'accounts', http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d7291e52/ui/scripts/accountsWizard.js ---------------------------------------------------------------------- diff --git a/ui/scripts/accountsWizard.js b/ui/scripts/accountsWizard.js index d84fbfa..e02a04e 100644 --- a/ui/scripts/accountsWizard.js +++ b/ui/scripts/accountsWizard.js @@ -16,6 +16,8 @@ // under the License. (function(cloudStack, $) { + var rootDomainId; + cloudStack.accountsWizard = { informationWithinLdap: { @@ -75,20 +77,9 @@ validation: { required: true }, - select: function(args) { - var data = {}; - - if (args.context.users) { // In accounts section - data.listAll = true; - } else if (args.context.domains) { // In domain section (use specific domain) - data.id = args.context.domains[0].id; - } - + select: function(args) { $.ajax({ - url: createURL("listDomains"), - data: data, - dataType: "json", - async: false, + url: createURL("listDomains"), success: function(json) { var items = []; domainObjs = json.listdomainsresponse.domain; @@ -204,8 +195,10 @@ } var accountType = args.data.accounttype; - if (args.data.accounttype == "1" && args.data.domainid != rootDomainId) { //if account type is admin, but domain is not Root domain - accountType = "2"; // Change accounttype from root-domain("1") to domain-admin("2") + if (accountType == "1") { //if "admin" is selected in account type dropdown + if (rootDomainId == undefined || args.data.domainid != rootDomainId ) { //but current login has no visibility to root domain object, or the selected domain is not root domain + accountType = "2"; // change accountType from root-domain("1") to domain-admin("2") + } } array1.push("&accounttype=" + accountType); @@ -268,48 +261,6 @@ } }); } - } - /* - action: function(args) { - var array1 = []; - - var username = args.data.username; - - array1.push("&domainid=" + args.data.domainid); - - if (args.data.account != null && args.data.account.length != 0) { - array1.push("&account=" + args.data.account); - } - - if (args.data.accounttype == "1" && args.data.domainid != rootDomainId) { - args.data.accounttype = "2"; - } - array1.push("&accountType=" + args.data.accounttype); - - if (args.data.timezone != null && args.data.timezone.length != 0) { - array1.push("&timezone=" + args.data.timezone); - } - if (args.data.networkdomain != null && args.data.networkdomain != 0) { - array1.push("&networkDomain=" + args.data.networkdomain); - } - - for (var i = 0; i < username.length; i++) { - $.ajax({ - url: createURL("ldapCreateAccount&username=" + username[i] + array1.join("")), - dataType: "json", - async: false, - success: function(json) { - var item = json.createaccountresponse.account; - args.response.success({ - data: item - }); - }, - error: function(XMLHttpResponse) { - args.response.error(parseXMLHttpResponse(XMLHttpResponse)); - } - }); - } - } - */ + } }; }(cloudStack, jQuery)); \ No newline at end of file
