mirror of https://github.com/apache/cloudstack.git
Guard NPE due to empty policies.
This commit is contained in:
parent
344d3a37cc
commit
d47d4bbd20
|
|
@ -2268,7 +2268,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
Object id = cmd.getId();
|
||||
Object keyword = cmd.getKeyword();
|
||||
Long domainId = cmd.getDomainId();
|
||||
Boolean isRootAdmin = _accountMgr.isRootAdmin(account.getType());
|
||||
Boolean isRootAdmin = _accountMgr.isRootAdmin(account.getAccountId());
|
||||
// Keeping this logic consistent with domain specific zones
|
||||
// if a domainId is provided, we just return the disk offering
|
||||
// associated with this domain
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ public class IAMServiceImpl extends ManagerBase implements IAMService, Manager {
|
|||
groupSB.selectFields(groupSB.entity().getAclGroupId());
|
||||
groupSB.and("account", groupSB.entity().getAccountId(), Op.EQ);
|
||||
SearchCriteria<Long> groupSc = groupSB.create();
|
||||
groupSc.setParameters("account", accountId);
|
||||
|
||||
List<Long> groupIds = _aclGroupAccountMapDao.customSearch(groupSc, null);
|
||||
|
||||
|
|
@ -340,7 +341,9 @@ public class IAMServiceImpl extends ManagerBase implements IAMService, Manager {
|
|||
policySc.setJoinParameters("accountgroupjoin", "account", accountId);
|
||||
|
||||
List<Long> policyIds = _aclGroupPolicyMapDao.customSearch(policySc, null);
|
||||
|
||||
if (policyIds == null || policyIds.size() == 0) {
|
||||
return new ArrayList<AclPolicy>();
|
||||
}
|
||||
SearchBuilder<AclPolicyVO> sb = _aclPolicyDao.createSearchBuilder();
|
||||
sb.and("ids", sb.entity().getId(), Op.IN);
|
||||
SearchCriteria<AclPolicyVO> sc = sb.create();
|
||||
|
|
@ -609,6 +612,10 @@ public class IAMServiceImpl extends ManagerBase implements IAMService, Manager {
|
|||
|
||||
boolean allowed = false;
|
||||
|
||||
if (policies == null || policies.size() == 0) {
|
||||
return allowed;
|
||||
}
|
||||
|
||||
List<Long> policyIds = new ArrayList<Long>();
|
||||
for (AclPolicy policy : policies) {
|
||||
policyIds.add(policy.getId());
|
||||
|
|
|
|||
Loading…
Reference in New Issue