Fixed listLoadBalancerRuleInstances to return all vms in the system for the ROOT admin

This commit is contained in:
alena 2010-12-10 15:33:06 -08:00
parent 4fd7a83645
commit acef5c9f5c
2 changed files with 7 additions and 16 deletions

View File

@ -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///////////////////
/////////////////////////////////////////////////////

View File

@ -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<UserVmVO> loadBalancerInstances = new ArrayList<UserVmVO>();