diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java index 40db387debe..64de9a70642 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java @@ -116,7 +116,7 @@ public class CreateProjectCmd extends BaseAsyncCreateCmd { throw new InvalidParameterValueException("Account name and domain id must be specified together"); } - if (userId != null && (accountId == null && domainId == null)) { + if (userId != null && (accountId == null || domainId == null)) { throw new InvalidParameterValueException("Account ID and Domain ID must be specified with userID"); } if (accountName != null) { diff --git a/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java b/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java index e8161bc4c65..ac975195d5e 100644 --- a/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java +++ b/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java @@ -1517,15 +1517,19 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q } if (accountId != null) { - sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.EQ); + if (userId == null) { + sb.and().op("accountId", sb.entity().getAccountId(), SearchCriteria.Op.EQ); + sb.and("userIdNull", sb.entity().getUserId(), Op.NULL); + sb.cp(); + } else { + sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.EQ); + } } if (userId != null) { sb.and().op("userId", sb.entity().getUserId(), Op.EQ); sb.or("userIdNull", sb.entity().getUserId(), Op.NULL); sb.cp(); - } else { - sb.and("userIdNull", sb.entity().getUserId(), Op.NULL); } SearchCriteria sc = sb.create(); @@ -2585,6 +2589,7 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q Object keyword = cmd.getKeyword(); Long startIndex = cmd.getStartIndex(); Long pageSize = cmd.getPageSizeVal(); + Boolean readonly = cmd.getReadonly(); Filter searchFilter = new Filter(ImageStoreJoinVO.class, "id", Boolean.TRUE, startIndex, pageSize); @@ -2597,6 +2602,7 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q sb.and("protocol", sb.entity().getProtocol(), SearchCriteria.Op.EQ); sb.and("provider", sb.entity().getProviderName(), SearchCriteria.Op.EQ); sb.and("role", sb.entity().getRole(), SearchCriteria.Op.EQ); + sb.and("readonly", sb.entity().isReadonly(), Op.EQ); SearchCriteria sc = sb.create(); sc.setParameters("role", DataStoreRole.Image); @@ -2625,6 +2631,9 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q if (protocol != null) { sc.setParameters("protocol", protocol); } + if (readonly != null) { + sc.setParameters("readonly", readonly); + } // search Store details by ids Pair, Integer> uniqueStorePair = _imageStoreJoinDao.searchAndCount(sc, searchFilter);