Summary: allow admin user to do whatever he wants

Reported-by: Ryan Dietrich <ryan@betterservers.com>
Signed-off-by: Marcus Sorensen <marcus@betterservers.com> 1359588792 -0700
This commit is contained in:
Marcus Sorensen 2013-01-30 16:33:12 -07:00
parent e430b7aedd
commit 437d30a295

View File

@ -954,7 +954,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
if (network.getGuestType() != Network.GuestType.Shared) { if (network.getGuestType() != Network.GuestType.Shared) {
// Check account permissions // Check account permissions
List<NetworkVO> networkMap = _networkDao.listBy(caller.getId(), network.getId()); 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"); 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) { if (network.getGuestType() != Network.GuestType.Shared) {
// Check account permissions // Check account permissions
List<NetworkVO> networkMap = _networkDao.listBy(caller.getId(), network.getId()); 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"); throw new PermissionDeniedException("Unable to modify a vm using network with id " + network.getId() + ", permission denied");
} }
} }