Skip to content

Commit 2bba381

Browse files
minchen07DaanHoogland
authored andcommitted
CLOUDSTACK-6501:IAM - DomainAdmin - When listVirtualMachines is used
with listall=true and account and domainId , Vms owned by the account account is not listed.
1 parent e811e61 commit 2bba381

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎server/src/com/cloud/user/AccountManagerImpl.java‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2283,7 +2283,11 @@ public void buildACLSearchParameters(Account caller, Long id, String accountName
22832283

22842284
if (accountId != null) {
22852285
// specific account filter is specified
2286-
if (grantedAccounts.contains(accountId)) {
2286+
if (grantedDomains.contains(domainId)) {
2287+
// the account domain is granted to the caller
2288+
permittedAccounts.add(accountId);
2289+
}
2290+
else if (grantedAccounts.contains(accountId)) {
22872291
permittedAccounts.add(accountId);
22882292
} else {
22892293
//TODO: we should also filter granted resources based on accountId passed.

‎services/iam/plugin/src/org/apache/cloudstack/iam/RoleBasedEntityQuerySelector.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public List<Long> getAuthorizedDomains(Account caller, String action, AccessType
7373
domainId = p.getScopeId();
7474
//domainIds.add(p.getScopeId());
7575
}
76-
domainIds.add(domainId);
77-
// add all the domain children from this domain. Like RoleBasedEntityAccessChecker, we made an assumption, if DOMAIN scope is granted, it means that
76+
//domainIds.add(domainId);
77+
// add all the domain children from this domain (including this domain itself). Like RoleBasedEntityAccessChecker, we made an assumption, if DOMAIN scope is granted, it means that
7878
// the whole domain tree is granted access.
7979
DomainVO domain = _domainDao.findById(domainId);
8080
List<Long> childDomains = _domainDao.getDomainChildrenIds(domain.getPath());

0 commit comments

Comments
 (0)