This is an automated email from the ASF dual-hosted git repository. solomax pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/openmeetings.git
The following commit(s) were added to refs/heads/master by this push: new fa67693a9 [OPENMEETINGS-2733] couple Sonar issues are addressed fa67693a9 is described below commit fa67693a96e153b3761ab76dfc327af8ef14772e Author: Maxim Solodovnik <solomax...@gmail.com> AuthorDate: Mon Jan 30 17:18:01 2023 +0700 [OPENMEETINGS-2733] couple Sonar issues are addressed --- README.md | 6 +++--- .../main/java/org/apache/openmeetings/db/dao/user/UserDao.java | 4 ++-- .../java/org/apache/openmeetings/db/entity/basic/Client.java | 10 +++++++++- .../main/java/org/apache/openmeetings/db/util/DaoHelper.java | 2 +- .../main/java/org/apache/openmeetings/web/app/OtpManager.java | 3 +-- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 9848c28ae..f9683efaf 100644 --- a/README.md +++ b/README.md @@ -32,13 +32,13 @@ Building and running To build from source code: - Requirements: - Sources compilation require `Java SE 17`, [Apache Maven 3.5.0 or later](https://maven.apache.org/). + Sources compilation require `Java SE 17`, [Apache Maven 3.8.7 or later](https://maven.apache.org/). - To build the OpenMeetings project run mvn in the root directory: `mvn clean install -PallModules` - To run the OpenMeetings project: - go to `openmeetings-server/target` directory - - extract `apache-openmeetings-x.x.x.tar.gz` (or `apache-openmeetings-x.x.x.zip` for windows) to **new** directory - - enter to this new directory and execute `./bin/startup.sh` (`./bin/startup.bat` for Windows) + - extract `apache-openmeetings-x.x.x.tar.gz` (or `apache-openmeetings-x.x.x.zip` for windows) + - enter `apache-openmeetings-x.x.x` directory and execute `./bin/startup.sh` (`./bin/startup.bat` for Windows) For a detailed documentation on how to build from source and options see: https://openmeetings.apache.org/BuildInstructions.html diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/user/UserDao.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/user/UserDao.java index ee68f4eca..4923f71bf 100644 --- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/user/UserDao.java +++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/user/UserDao.java @@ -212,7 +212,7 @@ public class UserDao implements IGroupAdminDataProviderDao<User> { private long count(String search, boolean filterContacts, Long currentUserId, boolean filterDeleted) { if (filterContacts) { return DaoHelper.count(em, User.class - , (builder, root) -> builder.countDistinct(root) + , CriteriaBuilder::countDistinct , search, searchFields, filterDeleted , (b, q) -> getOwnerContactsFilter(currentUserId, b, q)); } else { @@ -255,7 +255,7 @@ public class UserDao implements IGroupAdminDataProviderDao<User> { public Long searchCountUserProfile(Long userId, String search, String userOffers, String userSearches) { return DaoHelper.count(em, User.class - , (builder, root) -> builder.countDistinct(root) + , CriteriaBuilder::countDistinct , search, searchFields, true , (b, q) -> getProfileFilter(userId, userOffers, userSearches, b, q)); } diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java index 742e246c0..f1dbeacea 100644 --- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java +++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java @@ -339,8 +339,16 @@ public class Client implements IDataProviderEntity, IWsClient { a.put("country", user.getAddress().getCountry()); } } + final int level; + if (hasRight(Right.MODERATOR)) { + level = 5; + } else if(hasRight(Right.WHITEBOARD)) { + level = 3; + } else { + level = 1; + } return o.put("user", u) - .put("level", hasRight(Right.MODERATOR) ? 5 : (hasRight(Right.WHITEBOARD) ? 3 : 1)); + .put("level", level); } // package private for StremDesc diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/DaoHelper.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/DaoHelper.java index ce0a97220..9c6d96509 100644 --- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/DaoHelper.java +++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/DaoHelper.java @@ -59,7 +59,7 @@ public class DaoHelper { , boolean noDeleted , BiFunction<CriteriaBuilder, CriteriaQuery<?>, Predicate> filter) { - return count(em, clazz, (builder, root) -> builder.count(root), search, searchFields, noDeleted, filter); + return count(em, clazz, CriteriaBuilder::count, search, searchFields, noDeleted, filter); } public static <T> long count(EntityManager em diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/OtpManager.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/OtpManager.java index 3da9facf6..0c6abfe50 100644 --- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/OtpManager.java +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/OtpManager.java @@ -59,7 +59,6 @@ public class OtpManager { private static final HashingAlgorithm ALGORITHM = HashingAlgorithm.SHA1; private final SecretGenerator secretGenerator = new DefaultSecretGenerator(128); - private CodeGenerator codeGenerator; private CodeVerifier codeVerifier; @Value("${otp.issuer}") private String issuer = ""; @@ -70,7 +69,7 @@ public class OtpManager { @PostConstruct public void init() throws UnknownHostException { - codeGenerator = new DefaultCodeGenerator(ALGORITHM, DIGITS); + CodeGenerator codeGenerator = new DefaultCodeGenerator(ALGORITHM, DIGITS); TimeProvider timeProvider; try { timeProvider = new NtpTimeProvider(ntpServer, ntpTimeout);