Updated Branches:
  refs/heads/add_remove_nics e430b7aed -> 437d30a29

Summary: allow admin user to do whatever he wants

Reported-by: Ryan Dietrich <[email protected]>
Signed-off-by: Marcus Sorensen <[email protected]> 1359588792 -0700


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/437d30a2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/437d30a2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/437d30a2

Branch: refs/heads/add_remove_nics
Commit: 437d30a295ee482f97e3c6f45227970b107af72b
Parents: e430b7a
Author: Marcus Sorensen <[email protected]>
Authored: Wed Jan 30 16:33:12 2013 -0700
Committer: Marcus Sorensen <[email protected]>
Committed: Wed Jan 30 16:33:12 2013 -0700

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmManagerImpl.java |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/437d30a2/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 fd3fffd..82a8e25 100644
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -954,7 +954,7 @@ public class UserVmManagerImpl implements UserVmManager, 
UserVmService, Manager
         if (network.getGuestType() != Network.GuestType.Shared) {
             // Check account permissions
             List<NetworkVO> networkMap = _networkDao.listBy(caller.getId(), 
network.getId());
-            if (networkMap == null || networkMap.isEmpty()) {
+            if ((networkMap == null || networkMap.isEmpty() ) && 
caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
                 throw new PermissionDeniedException("Unable to modify a vm 
using network with id " + network.getId() + ", permission denied");
             }
         }
@@ -1031,7 +1031,7 @@ public class UserVmManagerImpl implements UserVmManager, 
UserVmService, Manager
         if (network.getGuestType() != Network.GuestType.Shared) {
             // Check account permissions
             List<NetworkVO> networkMap = _networkDao.listBy(caller.getId(), 
network.getId());
-            if (networkMap == null || networkMap.isEmpty()) {
+            if ((networkMap == null || networkMap.isEmpty() ) && 
caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
                 throw new PermissionDeniedException("Unable to modify a vm 
using network with id " + network.getId() + ", permission denied");
             }
         }

Reply via email to