From acef5c9f5c9456652b3795a904f43ec2e473188d Mon Sep 17 00:00:00 2001 From: alena Date: Fri, 10 Dec 2010 15:33:06 -0800 Subject: [PATCH] Fixed listLoadBalancerRuleInstances to return all vms in the system for the ROOT admin --- .../api/commands/UpdateLoadBalancerRuleCmd.java | 7 ------- .../lb/LoadBalancingRulesManagerImpl.java | 16 +++++++--------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/api/src/com/cloud/api/commands/UpdateLoadBalancerRuleCmd.java b/api/src/com/cloud/api/commands/UpdateLoadBalancerRuleCmd.java index fe675bd5a1e..35036f78a4e 100644 --- a/api/src/com/cloud/api/commands/UpdateLoadBalancerRuleCmd.java +++ b/api/src/com/cloud/api/commands/UpdateLoadBalancerRuleCmd.java @@ -51,9 +51,6 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCmd { @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the load balancer rule") private String loadBalancerName; -// @Parameter(name=ApiConstants.PRIVATE_PORT, type=CommandType.STRING, description="the private port of the private ip address/virtual machine where the network traffic will be load balanced to") -// private String privatePort; - ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -74,10 +71,6 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCmd { return loadBalancerName; } -// public String getPrivatePort() { -// return privatePort; -// } - ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java index fa7fbe59585..c8f725909d0 100644 --- a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java +++ b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java @@ -1143,16 +1143,14 @@ public class LoadBalancingRulesManagerImpl implements LoadBalancingRulesManager, return null; } - if (account != null) { - long lbAcctId = loadBalancer.getAccountId(); - if (account.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) { - Account userAccount = _accountDao.findById(lbAcctId); - if (!_domainDao.isChildDomain(account.getDomainId(), userAccount.getDomainId())) { - throw new PermissionDeniedException("Invalid load balancer rule id (" + loadBalancerId + ") given, unable to list load balancer instances."); - } - } else if (account.getId() != lbAcctId) { - throw new PermissionDeniedException("Unable to list load balancer instances, account " + account.getAccountName() + " does not own load balancer rule " + loadBalancer.getName()); + long lbAcctId = loadBalancer.getAccountId(); + if (account.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) { + Account userAccount = _accountDao.findById(lbAcctId); + if (!_domainDao.isChildDomain(account.getDomainId(), userAccount.getDomainId())) { + throw new PermissionDeniedException("Invalid load balancer rule id (" + loadBalancerId + ") given, unable to list load balancer instances."); } + } else if (account.getType() == Account.ACCOUNT_TYPE_NORMAL && account.getId() != lbAcctId) { + throw new PermissionDeniedException("Unable to list load balancer instances, account " + account.getAccountName() + " does not own load balancer rule " + loadBalancer.getName()); } List loadBalancerInstances = new ArrayList();