cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject git commit: updated refs/heads/rbac to 91e176c
Date Wed, 20 Nov 2013 00:42:10 GMT
Updated Branches:
  refs/heads/rbac 6c3038b66 -> 91e176cb0


Fix a bug in listVm logic to use revokedIds and grantedIds.

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

Branch: refs/heads/rbac
Commit: 91e176cb0d8365c2ab5c79e08221606fea8ca2b1
Parents: 6c3038b
Author: Min Chen <min.chen@citrix.com>
Authored: Tue Nov 19 16:41:40 2013 -0800
Committer: Min Chen <min.chen@citrix.com>
Committed: Tue Nov 19 16:41:40 2013 -0800

----------------------------------------------------------------------
 .../contrail/management/MockAccountManager.java |  7 +++++
 .../com/cloud/api/query/QueryManagerImpl.java   |  4 +--
 server/src/com/cloud/user/AccountManager.java   |  5 ++++
 .../src/com/cloud/user/AccountManagerImpl.java  | 27 ++++++++++++++++++++
 .../com/cloud/user/MockAccountManagerImpl.java  |  7 +++++
 5 files changed, 48 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/91e176cb/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/MockAccountManager.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/MockAccountManager.java
b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/MockAccountManager.java
index 29dc50a..4afc043 100644
--- a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/MockAccountManager.java
+++ b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/MockAccountManager.java
@@ -378,6 +378,13 @@ public class MockAccountManager extends ManagerBase implements AccountManager
{
         // TODO Auto-generated method stub
 
     }
+
+    @Override
+    public void buildACLViewSearchCriteria(SearchCriteria<? extends ControlledEntity>
sc, Long domainId, boolean isRecursive, List<Long> permittedAccounts,
+            ListProjectResourcesCriteria listProjectResourcesCriteria, List<Long> grantedIds,
List<Long> revokedIds) {
+        // TODO Auto-generated method stub
+
+    }
     
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/91e176cb/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index 1bcf578..367f418 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -381,7 +381,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
     public ListResponse<UserResponse> searchForUsers(ListUsersCmd cmd) throws PermissionDeniedException
{
         Pair<List<UserAccountJoinVO>, Integer> result = searchForUsersInternal(cmd);
         ListResponse<UserResponse> response = new ListResponse<UserResponse>();
-        List<UserResponse> userResponses = ViewResponseHelper.createUserResponse(CallContext.current().getCallingAccount().getDomainId(),

+        List<UserResponse> userResponses = ViewResponseHelper.createUserResponse(CallContext.current().getCallingAccount().getDomainId(),
                 result.first().toArray(new UserAccountJoinVO[result.first().size()]));
         response.setResponses(userResponses, result.second());
         return response;
@@ -857,7 +857,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
 
         // building ACL search criteria
         _accountMgr.buildACLViewSearchCriteria(sc, domainId, isRecursive, permittedAccounts,
-                listProjectResourcesCriteria);
+                listProjectResourcesCriteria, grantedIds, revokedIds);
 
         if (tags != null && !tags.isEmpty()) {
             SearchCriteria<UserVmJoinVO> tagSc = _userVmJoinDao.createSearchCriteria();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/91e176cb/server/src/com/cloud/user/AccountManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/AccountManager.java b/server/src/com/cloud/user/AccountManager.java
index 0fac6ed..24bf648 100755
--- a/server/src/com/cloud/user/AccountManager.java
+++ b/server/src/com/cloud/user/AccountManager.java
@@ -96,9 +96,14 @@ public interface AccountManager extends AccountService {
 	void buildACLSearchCriteria(SearchCriteria<? extends ControlledEntity> sc,
 			Long domainId, boolean isRecursive, List<Long> permittedAccounts, ListProjectResourcesCriteria
listProjectResourcesCriteria);
 
+
     void buildACLViewSearchCriteria(SearchCriteria<? extends ControlledViewEntity>
sc,
             Long domainId, boolean isRecursive, List<Long> permittedAccounts, ListProjectResourcesCriteria
listProjectResourcesCriteria);
 
+    void buildACLViewSearchCriteria(SearchCriteria<? extends ControlledEntity> sc,
+            Long domainId, boolean isRecursive, List<Long> permittedAccounts, ListProjectResourcesCriteria
listProjectResourcesCriteria, List<Long> grantedIds,
+            List<Long> revokedIds);
+
 	void buildACLSearchParameters(Account caller, Long id,
 			String accountName, Long projectId, List<Long> permittedAccounts, Ternary<Long,
Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject, boolean listAll, boolean
forProjectInvitation);
 	

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/91e176cb/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 a88b614..d8f2ae6 100755
--- a/server/src/com/cloud/user/AccountManagerImpl.java
+++ b/server/src/com/cloud/user/AccountManagerImpl.java
@@ -2468,6 +2468,29 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager,
M
     @Override
     public void buildACLViewSearchCriteria(SearchCriteria<? extends ControlledViewEntity>
sc,
             Long domainId, boolean isRecursive, List<Long> permittedAccounts, ListProjectResourcesCriteria
listProjectResourcesCriteria) {
+        if (listProjectResourcesCriteria != null) {
+            sc.setParameters("accountType", Account.ACCOUNT_TYPE_PROJECT);
+        }
+
+        if (!permittedAccounts.isEmpty()) {
+            sc.setParameters("accountIdIN", permittedAccounts.toArray());
+        } else if (domainId != null) {
+            DomainVO domain = _domainDao.findById(domainId);
+            if (isRecursive) {
+                sc.setParameters("domainPath", domain.getPath() + "%");
+            } else {
+                sc.setParameters("domainId", domainId);
+            }
+        }
+
+    }
+
+    @Override
+    public void buildACLViewSearchCriteria(SearchCriteria<? extends ControlledEntity>
sc, Long domainId, boolean isRecursive, List<Long> permittedAccounts,
+            ListProjectResourcesCriteria listProjectResourcesCriteria, List<Long> grantedIds,
List<Long> revokedIds) {
+        if (!revokedIds.isEmpty()) {
+            sc.setParameters("idNIN", revokedIds.toArray());
+        }
 
         if (listProjectResourcesCriteria != null) {
             sc.setParameters("accountType", Account.ACCOUNT_TYPE_PROJECT);
@@ -2483,6 +2506,10 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager,
M
                 sc.setParameters("domainId", domainId);
             }
         }
+
+        if (!grantedIds.isEmpty()) {
+            sc.setParameters("idIN", grantedIds.toArray());
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/91e176cb/server/test/com/cloud/user/MockAccountManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/user/MockAccountManagerImpl.java b/server/test/com/cloud/user/MockAccountManagerImpl.java
index a933e70..756abee 100644
--- a/server/test/com/cloud/user/MockAccountManagerImpl.java
+++ b/server/test/com/cloud/user/MockAccountManagerImpl.java
@@ -299,6 +299,13 @@ public class MockAccountManagerImpl extends ManagerBase implements Manager,
Acco
         // TODO Auto-generated method stub
     }
 
+    @Override
+    public void buildACLViewSearchCriteria(SearchCriteria<? extends ControlledEntity>
sc, Long domainId, boolean isRecursive, List<Long> permittedAccounts,
+            ListProjectResourcesCriteria listProjectResourcesCriteria, List<Long> grantedIds,
List<Long> revokedIds) {
+        // TODO Auto-generated method stub
+
+    }
+
     /* (non-Javadoc)
      * @see com.cloud.user.AccountService#getUserByApiKey(java.lang.String)
      */


Mime
View raw message