incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [3/3] git commit: Fixed listNetworks for the case when a) caller is an admin 2) projectId=-1 is specified - admin wasn't able to list networks belonging to regular users' projects
Date Wed, 14 Nov 2012 23:10:10 GMT
Fixed listNetworks for the case when a) caller is an admin 2) projectId=-1 is specified - admin
wasn't able to list networks belonging to regular users' projects


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

Branch: refs/heads/master
Commit: 74622a4dc37ab14da6a78bbb209aa9d08ca854a0
Parents: 9d7f48c
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Tue Nov 6 16:02:20 2012 -0800
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Wed Nov 14 14:59:51 2012 -0800

----------------------------------------------------------------------
 api/src/com/cloud/api/commands/ListZonesByCmd.java |    1 -
 .../src/com/cloud/network/NetworkManagerImpl.java  |    9 ++++++---
 server/src/com/cloud/user/AccountManagerImpl.java  |    4 ++--
 3 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/74622a4d/api/src/com/cloud/api/commands/ListZonesByCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListZonesByCmd.java b/api/src/com/cloud/api/commands/ListZonesByCmd.java
index 169a44d..f3016e9 100755
--- a/api/src/com/cloud/api/commands/ListZonesByCmd.java
+++ b/api/src/com/cloud/api/commands/ListZonesByCmd.java
@@ -26,7 +26,6 @@ import com.cloud.api.BaseListCmd;
 import com.cloud.api.IdentityMapper;
 import com.cloud.api.Implementation;
 import com.cloud.api.Parameter;
-import com.cloud.api.BaseCmd.CommandType;
 import com.cloud.api.response.ListResponse;
 import com.cloud.api.response.ZoneResponse;
 import com.cloud.dc.DataCenter;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/74622a4d/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index ab1ee78..540639b 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -203,6 +203,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.Ip;
 import com.cloud.utils.net.NetUtils;
 import com.cloud.vm.Nic;
+import com.cloud.vm.Nic.ReservationStrategy;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.NicVO;
 import com.cloud.vm.ReservationContext;
@@ -3030,7 +3031,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService,
Manag
             }
         }
 
-        if (!_accountMgr.isAdmin(caller.getType()) || (!listAll && (projectId !=
null && projectId != -1 && domainId == null))) {
+        if (!_accountMgr.isAdmin(caller.getType()) || (!listAll && (projectId !=
null && projectId.longValue() != -1 && domainId == null))) {
             permittedAccounts.add(caller.getId());
             domainId = caller.getDomainId();
         }
@@ -3038,8 +3039,10 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService,
Manag
         // set project information
         boolean skipProjectNetworks = true;
         if (projectId != null) {
-            if (projectId == -1) {
-                permittedAccounts.addAll(_projectMgr.listPermittedProjectAccounts(caller.getId()));
+            if (projectId.longValue() == -1) {
+                if (!_accountMgr.isAdmin(caller.getType())) {
+                    permittedAccounts.addAll(_projectMgr.listPermittedProjectAccounts(caller.getId()));
+                }
             } else {
                 permittedAccounts.clear();
                 Project project = _projectMgr.getProject(projectId);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/74622a4d/server/src/com/cloud/user/AccountManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java
index 0def008..b19134d 100755
--- a/server/src/com/cloud/user/AccountManagerImpl.java
+++ b/server/src/com/cloud/user/AccountManagerImpl.java
@@ -1576,7 +1576,7 @@ public class AccountManagerImpl implements AccountManager, AccountService,
Manag
 
         // set project information
         if (projectId != null) {
-            if (projectId == -1) {
+            if (projectId.longValue() == -1) {
                 permittedAccounts.addAll(_projectMgr.listPermittedProjectAccounts(caller.getId()));
             } else {
                 permittedAccounts.clear();
@@ -2327,7 +2327,7 @@ public class AccountManagerImpl implements AccountManager, AccountService,
Manag
         // set project information
         if (projectId != null) {
             if (!forProjectInvitation) {
-                if (projectId == -1) {
+                if (projectId.longValue() == -1) {
                     if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL) {
                         permittedAccounts.addAll(_projectMgr.listPermittedProjectAccounts(caller.getId()));
                     } else {


Mime
View raw message