This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch 4.0.x
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/4.0.x by this push:
     new 2797b5e  [OPENMEETINGS-1864] tests should be fixed
2797b5e is described below

commit 2797b5ee69e5fe44a52b6f007f1d05d0089fcca0
Author: Maxim Solodovnik <solomax...@gmail.com>
AuthorDate: Sat Apr 7 17:27:40 2018 +0700

    [OPENMEETINGS-1864] tests should be fixed
---
 .../org/apache/openmeetings/core/ldap/LdapLoginManager.java   |  4 ++--
 .../apache/openmeetings/db/dao/basic/ConfigurationDao.java    | 11 +++++++++++
 .../apache/openmeetings/installation/ImportInitvalues.java    |  3 ++-
 .../org/apache/openmeetings/service/user/UserManager.java     |  6 +++---
 .../org/apache/openmeetings/util/OpenmeetingsVariables.java   |  9 +++++++++
 .../org/apache/openmeetings/webservice/UserWebService.java    |  8 +++++++-
 6 files changed, 34 insertions(+), 7 deletions(-)

diff --git 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/ldap/LdapLoginManager.java
 
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/ldap/LdapLoginManager.java
index ea16e07..e957177 100644
--- 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/ldap/LdapLoginManager.java
+++ 
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/ldap/LdapLoginManager.java
@@ -24,7 +24,7 @@ import static 
org.apache.openmeetings.db.util.LocaleHelper.validateCountry;
 import static org.apache.openmeetings.db.util.TimezoneUtil.getTimeZone;
 import static org.apache.openmeetings.util.OmException.BAD_CREDENTIALS;
 import static org.apache.openmeetings.util.OmException.UNKNOWN;
-import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DEFAULT_GROUP_ID;
+import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getDefaultGroup;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
 
 import java.io.Closeable;
@@ -345,7 +345,7 @@ public class LdapLoginManager {
                                u.setType(Type.ldap);
                                u.getRights().remove(Right.Login);
                                u.setDomainId(domainId);
-                               Group g = 
groupDao.get(cfgDao.getLong(CONFIG_DEFAULT_GROUP_ID, null));
+                               Group g = groupDao.get(getDefaultGroup());
                                if (g != null) {
                                        u.getGroupUsers().add(new GroupUser(g, 
u));
                                }
diff --git 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java
 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java
index f3aa65f..561e233 100644
--- 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java
+++ 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java
@@ -22,6 +22,7 @@ import static org.apache.commons.lang3.math.NumberUtils.toInt;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_APPLICATION_BASE_URL;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_APPLICATION_NAME;
 import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_CRYPT;
+import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DEFAULT_GROUP_ID;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DEFAULT_LANG;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DEFAULT_TIMEZONE;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_EXT_PROCESS_TTL;
@@ -61,6 +62,7 @@ import static 
org.apache.openmeetings.util.OpenmeetingsVariables.FLASH_SSL_PORT;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.FLASH_VIDEO_CODEC;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.USER_LOGIN_MINIMUM_LENGTH;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.USER_PASSWORD_MINIMUM_LENGTH;
+import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getDefaultGroup;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getRoomSettings;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getWicketApplicationName;
@@ -69,6 +71,7 @@ import static 
org.apache.openmeetings.util.OpenmeetingsVariables.setAudioBitrate
 import static org.apache.openmeetings.util.OpenmeetingsVariables.setAudioRate;
 import static org.apache.openmeetings.util.OpenmeetingsVariables.setBaseUrl;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.setCryptClassName;
+import static 
org.apache.openmeetings.util.OpenmeetingsVariables.setDefaultGroup;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.setDefaultLang;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.setExtProcessTtl;
 import static org.apache.openmeetings.util.OpenmeetingsVariables.setGaCode;
@@ -363,6 +366,9 @@ public class ConfigurationDao implements 
IDataProviderDao<Configuration> {
                        case CONFIG_PASS_MIN_LENGTH:
                                reloadPasswdMinLength();
                                break;
+                       case CONFIG_DEFAULT_GROUP_ID:
+                               reloadDefaultGroup();
+                               break;
                }
                return entity;
        }
@@ -442,6 +448,10 @@ public class ConfigurationDao implements 
IDataProviderDao<Configuration> {
                setMinPasswdLength(getInt(CONFIG_LOGIN_MIN_LENGTH, 
USER_PASSWORD_MINIMUM_LENGTH));
        }
 
+       private void reloadDefaultGroup() {
+               setDefaultGroup(getLong(CONFIG_DEFAULT_GROUP_ID, 
getDefaultGroup()));
+       }
+
        public void reinit() {
                reloadMaxUpload();
                reloadCrypt();
@@ -457,6 +467,7 @@ public class ConfigurationDao implements 
IDataProviderDao<Configuration> {
                reloadRoomSettings();
                reloadLoginMinLength();
                reloadPasswdMinLength();
+               reloadDefaultGroup();
        }
 
        private JSONObject reloadRoomSettings() {
diff --git 
a/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
 
b/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
index 3d529fc..d89fe95 100644
--- 
a/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
+++ 
b/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
@@ -95,6 +95,7 @@ import static 
org.apache.openmeetings.util.OpenmeetingsVariables.USER_LOGIN_MINI
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.USER_PASSWORD_MINIMUM_LENGTH;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getAudioBitrate;
 import static org.apache.openmeetings.util.OpenmeetingsVariables.getAudioRate;
+import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getDefaultGroup;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getExtProcessTtl;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
 
@@ -193,7 +194,7 @@ public class ImportInitvalues {
                addCfg(list, CONFIG_REGISTER_SOAP, String.valueOf(true), 
Configuration.Type.bool, "Is user register available via SOAP/REST", VER_3_0);
                addCfg(list, CONFIG_REGISTER_OAUTH, String.valueOf(true), 
Configuration.Type.bool, "Is user register available via OAuth", VER_3_0);
                // this group_id is the Group of users who register through the 
frontend or SOAP
-               addCfg(list, CONFIG_DEFAULT_GROUP_ID, "1", 
Configuration.Type.number, "", VER_1_8);
+               addCfg(list, CONFIG_DEFAULT_GROUP_ID, 
String.valueOf(getDefaultGroup()), Configuration.Type.number, "", VER_1_8);
 
                addCfg(list, CONFIG_SMTP_SERVER, cfg.getSmtpServer(), 
Configuration.Type.string, "this is the smtp server to send messages", VER_1_9);
 
diff --git 
a/openmeetings-service/src/main/java/org/apache/openmeetings/service/user/UserManager.java
 
b/openmeetings-service/src/main/java/org/apache/openmeetings/service/user/UserManager.java
index 257e792..7134de3 100644
--- 
a/openmeetings-service/src/main/java/org/apache/openmeetings/service/user/UserManager.java
+++ 
b/openmeetings-service/src/main/java/org/apache/openmeetings/service/user/UserManager.java
@@ -22,10 +22,10 @@ import static 
org.apache.openmeetings.db.dao.user.UserDao.getNewUserInstance;
 import static org.apache.openmeetings.db.util.TimezoneUtil.getTimeZone;
 import static org.apache.openmeetings.util.OmException.UNKNOWN;
 import static org.apache.openmeetings.util.OmFileHelper.HIBERNATE;
-import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DEFAULT_GROUP_ID;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_EMAIL_VERIFICATION;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_REGISTER_SOAP;
 import static org.apache.openmeetings.util.OpenmeetingsVariables.getBaseUrl;
+import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getDefaultGroup;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getDefaultLang;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getMinLoginLength;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
@@ -125,7 +125,7 @@ public class UserManager implements IUserManager {
 
                                // this is needed cause the language is not a 
needed data at registering
                                u.setLanguageId(languageId != 0 ? languageId : 
1);
-                               u.getGroupUsers().add(new 
GroupUser(groupDao.get(cfgDao.getLong(CONFIG_DEFAULT_GROUP_ID, null)), u));
+                               u.getGroupUsers().add(new 
GroupUser(groupDao.get(getDefaultGroup()), u));
 
                                Object user = registerUser(u, password, null);
 
@@ -285,7 +285,7 @@ public class UserManager implements IUserManager {
                        u.setType(Type.oauth);
                        u.getRights().remove(Right.Login);
                        u.setDomainId(serverId);
-                       u.getGroupUsers().add(new 
GroupUser(groupDao.get(cfgDao.getLong(CONFIG_DEFAULT_GROUP_ID, null)), u));
+                       u.getGroupUsers().add(new 
GroupUser(groupDao.get(getDefaultGroup()), u));
                        u.setLogin(user.getUid());
                        u.setShowContactDataToContacts(true);
                        u.setLastname(user.getLastName());
diff --git 
a/openmeetings-util/src/main/java/org/apache/openmeetings/util/OpenmeetingsVariables.java
 
b/openmeetings-util/src/main/java/org/apache/openmeetings/util/OpenmeetingsVariables.java
index 429de2c..3b5cfaa 100644
--- 
a/openmeetings-util/src/main/java/org/apache/openmeetings/util/OpenmeetingsVariables.java
+++ 
b/openmeetings-util/src/main/java/org/apache/openmeetings/util/OpenmeetingsVariables.java
@@ -131,6 +131,7 @@ public class OpenmeetingsVariables {
        private static boolean sipEnabled = false;
        private static String gaCode = null;
        private static Long defaultLang = 1L;
+       private static Long defaultGroup = 1L;
        private static int audioRate = 22050;
        private static String audioBitrate = "32k";
        private static String defaultTimezone = "Europe/Berlin";
@@ -285,4 +286,12 @@ public class OpenmeetingsVariables {
        public static void setMinPasswdLength(int length) {
                minPasswdLength = length;
        }
+
+       public static Long getDefaultGroup() {
+               return defaultGroup;
+       }
+
+       public static void setDefaultGroup(Long group) {
+               defaultGroup = group;
+       }
 }
diff --git 
a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java
 
b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java
index 2cad7cc..3666c18 100644
--- 
a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java
+++ 
b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java
@@ -19,6 +19,7 @@
 package org.apache.openmeetings.webservice;
 
 import static org.apache.openmeetings.db.dto.basic.ServiceResult.UNKNOWN;
+import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getDefaultGroup;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getDefaultTimezone;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
 import static org.apache.openmeetings.webservice.Constants.TNS;
@@ -45,6 +46,7 @@ import javax.ws.rs.core.MediaType;
 import org.apache.cxf.feature.Features;
 import org.apache.openmeetings.core.util.StrongPasswordValidator;
 import org.apache.openmeetings.db.dao.server.SOAPLoginDao;
+import org.apache.openmeetings.db.dao.user.GroupDao;
 import org.apache.openmeetings.db.dao.user.IUserManager;
 import org.apache.openmeetings.db.dao.user.UserDao;
 import org.apache.openmeetings.db.dto.basic.ServiceResult;
@@ -55,6 +57,7 @@ import org.apache.openmeetings.db.dto.user.UserDTO;
 import org.apache.openmeetings.db.entity.server.RemoteSessionObject;
 import org.apache.openmeetings.db.entity.server.Sessiondata;
 import org.apache.openmeetings.db.entity.user.Address;
+import org.apache.openmeetings.db.entity.user.GroupUser;
 import org.apache.openmeetings.db.entity.user.User;
 import org.apache.openmeetings.db.entity.user.User.Right;
 import org.apache.openmeetings.db.manager.IClientManager;
@@ -183,7 +186,10 @@ public class UserWebService extends BaseWebService {
                        }
                        Object _user;
                        try {
-                               _user = 
getBean(UserManager.class).registerUser(user.get(userDao), user.getPassword(), 
null);
+                               User u = user.get(userDao);
+                               GroupDao groupDao = getBean(GroupDao.class);
+                               u.getGroupUsers().add(new 
GroupUser(groupDao.get(getDefaultGroup()), u));
+                               _user = 
getBean(UserManager.class).registerUser(u, user.getPassword(), null);
                        } catch (NoSuchAlgorithmException | OmException e) {
                                throw new ServiceException("Unexpected error 
while creating user");
                        }

-- 
To stop receiving notification emails like this one, please contact
solo...@apache.org.

Reply via email to