Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0333F10444 for ; Thu, 16 Jan 2014 21:34:38 +0000 (UTC) Received: (qmail 45084 invoked by uid 500); 16 Jan 2014 21:34:37 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 45056 invoked by uid 500); 16 Jan 2014 21:34:37 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 45048 invoked by uid 99); 16 Jan 2014 21:34:36 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jan 2014 21:34:36 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 990335279E; Thu, 16 Jan 2014 21:34:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: alena1108@apache.org To: commits@cloudstack.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/4.3 to 9c32605 Date: Thu, 16 Jan 2014 21:34:36 +0000 (UTC) Updated Branches: refs/heads/4.3 233f0f618 -> 9c32605f2 CLOUDSTACK-4987: when addNic to vm, don't make account check if the call is made by ROOT admin Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9c32605f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9c32605f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9c32605f Branch: refs/heads/4.3 Commit: 9c32605f2b877134df4b512dea4ea8c4fa8e65e9 Parents: 233f0f6 Author: Alena Prokharchyk Authored: Thu Jan 16 13:27:09 2014 -0800 Committer: Alena Prokharchyk Committed: Thu Jan 16 13:35:04 2014 -0800 ---------------------------------------------------------------------- server/src/com/cloud/vm/UserVmManagerImpl.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9c32605f/server/src/com/cloud/vm/UserVmManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index a3dbcb7..ea38d12 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -987,8 +987,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir throw new InvalidParameterValueException("unable to find a network with id " + networkId); } - Account vmOwner = _accountMgr.getAccount(vmInstance.getAccountId()); - if (vmOwner.getType() != Account.ACCOUNT_TYPE_ADMIN) { + if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN) { if (!(network.getGuestType() == Network.GuestType.Shared && network.getAclType() == ACLType.Domain) && !(network.getAclType() == ACLType.Account && network.getAccountId() == vmInstance.getAccountId())) { throw new InvalidParameterValueException("only shared network or isolated network with the same account_id can be added to vmId: " + vmId); @@ -2799,8 +2798,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir + zone.getId()); } - Account vmOwner = _accountMgr.getAccount(accountId); - if (vmOwner.getType() != Account.ACCOUNT_TYPE_ADMIN) { + //relax the check if the caller is admin account + if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN) { if (!(network.getGuestType() == Network.GuestType.Shared && network.getAclType() == ACLType.Domain) && !(network.getAclType() == ACLType.Account && network.getAccountId() == accountId)) { throw new InvalidParameterValueException("only shared network or isolated network with the same account_id can be added to vm");