cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject git commit: updated refs/heads/master to 47fd67b
Date Thu, 16 Jan 2014 21:40:16 GMT
Updated Branches:
  refs/heads/master 3b8e5bdc8 -> 47fd67b7f


    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/47fd67b7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/47fd67b7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/47fd67b7

Branch: refs/heads/master
Commit: 47fd67b7faad2d41b71bbcd7bbd8672e50693573
Parents: 3b8e5bd
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Thu Jan 16 13:27:09 2014 -0800
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Thu Jan 16 13:34:45 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/47fd67b7/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 5a4cea4..f57e1b4 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -966,8 +966,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);
@@ -2638,8 +2637,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
                 throw new InvalidParameterValueException("Network id=" + network.getId()
+ " doesn't belong to zone " + 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");


Mime
View raw message