You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "DaanHoogland (via GitHub)" <gi...@apache.org> on 2023/02/06 14:09:24 UTC
[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #7169: server: fix exception while list users with keyword
DaanHoogland commented on code in PR #7169:
URL: https://github.com/apache/cloudstack/pull/7169#discussion_r1097423281
##########
server/src/main/java/com/cloud/api/query/QueryManagerImpl.java:
##########
@@ -617,7 +618,9 @@ private Pair<List<UserAccountJoinVO>, Integer> getUserListInternal(Account calle
ssc.addOr("email", Op.LIKE, "%" + keyword + "%");
ssc.addOr("state", Op.LIKE, "%" + keyword + "%");
ssc.addOr("accountName", Op.LIKE, "%" + keyword + "%");
- ssc.addOr("accountType", Op.LIKE, "%" + keyword + "%");
+ if (EnumUtils.isValidEnum(Account.Type.class, keyword.toString().toUpperCase())) {
+ ssc.addOr("accountType", Op.EQ, EnumUtils.getEnum(Account.Type.class, keyword.toString().toUpperCase()));
+ }
Review Comment:
can this be simpler using `Account.Type.valueof(keyword)`? also I think `keyword` does not need a `.toString()`call.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org