Skip to content

Commit ba11bdf

Browse files
author
Pearl Dsilva
committed
Regression fix
1 parent a348afe commit ba11bdf

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

api/src/main/java/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public long getEntityOwnerId() {
116116
throw new InvalidParameterValueException("Account name and domain id must be specified together");
117117
}
118118

119-
if (userId != null && (accountId == null && domainId == null)) {
119+
if (userId != null && (accountId == null || domainId == null)) {
120120
throw new InvalidParameterValueException("Account ID and Domain ID must be specified with userID");
121121
}
122122
if (accountName != null) {

server/src/main/java/com/cloud/api/query/QueryManagerImpl.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,15 +1517,19 @@ private Pair<List<ProjectJoinVO>, Integer> listProjectsInternal(ListProjectsCmd
15171517
}
15181518

15191519
if (accountId != null) {
1520-
sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.EQ);
1520+
if (userId == null) {
1521+
sb.and().op("accountId", sb.entity().getAccountId(), SearchCriteria.Op.EQ);
1522+
sb.and("userIdNull", sb.entity().getUserId(), Op.NULL);
1523+
sb.cp();
1524+
} else {
1525+
sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.EQ);
1526+
}
15211527
}
15221528

15231529
if (userId != null) {
15241530
sb.and().op("userId", sb.entity().getUserId(), Op.EQ);
15251531
sb.or("userIdNull", sb.entity().getUserId(), Op.NULL);
15261532
sb.cp();
1527-
} else {
1528-
sb.and("userIdNull", sb.entity().getUserId(), Op.NULL);
15291533
}
15301534

15311535
SearchCriteria<ProjectJoinVO> sc = sb.create();
@@ -2585,6 +2589,7 @@ private Pair<List<ImageStoreJoinVO>, Integer> searchForImageStoresInternal(ListI
25852589
Object keyword = cmd.getKeyword();
25862590
Long startIndex = cmd.getStartIndex();
25872591
Long pageSize = cmd.getPageSizeVal();
2592+
Boolean readonly = cmd.getReadonly();
25882593

25892594
Filter searchFilter = new Filter(ImageStoreJoinVO.class, "id", Boolean.TRUE, startIndex, pageSize);
25902595

@@ -2597,6 +2602,7 @@ private Pair<List<ImageStoreJoinVO>, Integer> searchForImageStoresInternal(ListI
25972602
sb.and("protocol", sb.entity().getProtocol(), SearchCriteria.Op.EQ);
25982603
sb.and("provider", sb.entity().getProviderName(), SearchCriteria.Op.EQ);
25992604
sb.and("role", sb.entity().getRole(), SearchCriteria.Op.EQ);
2605+
sb.and("readonly", sb.entity().isReadonly(), Op.EQ);
26002606

26012607
SearchCriteria<ImageStoreJoinVO> sc = sb.create();
26022608
sc.setParameters("role", DataStoreRole.Image);
@@ -2625,6 +2631,9 @@ private Pair<List<ImageStoreJoinVO>, Integer> searchForImageStoresInternal(ListI
26252631
if (protocol != null) {
26262632
sc.setParameters("protocol", protocol);
26272633
}
2634+
if (readonly != null) {
2635+
sc.setParameters("readonly", readonly);
2636+
}
26282637

26292638
// search Store details by ids
26302639
Pair<List<ImageStoreJoinVO>, Integer> uniqueStorePair = _imageStoreJoinDao.searchAndCount(sc, searchFilter);

0 commit comments

Comments
 (0)