Fixed assignToLoadBalancer command - admin couldn't assing LB rule in behalf of other user

This commit is contained in:
alena 2010-11-22 17:04:32 -08:00
parent 8995e5d2f7
commit 3f1abbcbc8
1 changed files with 2 additions and 2 deletions

View File

@ -1173,11 +1173,11 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
// Permission check...
Account account = UserContext.current().getAccount();
if (account != null) {
if ((account.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) || (account.getType() == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN)) {
if (account.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) {
if (!_domainDao.isChildDomain(account.getDomainId(), loadBalancer.getDomainId())) {
throw new PermissionDeniedException("Failed to assign to load balancer " + loadBalancerId + ", permission denied.");
}
} else if (account.getId() != loadBalancer.getAccountId()) {
} else if (account.getType() != Account.ACCOUNT_TYPE_ADMIN && account.getId() != loadBalancer.getAccountId()) {
throw new PermissionDeniedException("Failed to assign to load balancer " + loadBalancerId + ", permission denied.");
}
}