Author: sebawagner
Date: Thu May 3 18:31:08 2012
New Revision: 1333578
URL: http://svn.apache.org/viewvc?rev=1333578&view=rev
Log:
OPENMEETINGS-252 Fix ImportInitValues.java default.timezone not taken from
install config and add (optional) mapping "ldap_user_attr_timezone" in the ldap
config
Modified:
incubator/openmeetings/trunk/singlewebapp/WebContent/conf/om_ldap.cfg
incubator/openmeetings/trunk/singlewebapp/WebContent/conf/sample_openldap_om_ldap.cfg
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/basic/dao/OmTimeZoneDaoImpl.java
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/installation/ImportInitvalues.java
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/installation/InstallationConfig.java
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/ldap/LdapAuthBase.java
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/ldap/LdapLoginManagement.java
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/BackupImportController.java
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/Install.java
Modified: incubator/openmeetings/trunk/singlewebapp/WebContent/conf/om_ldap.cfg
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/conf/om_ldap.cfg?rev=1333578&r1=1333577&r2=1333578&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/WebContent/conf/om_ldap.cfg
(original)
+++ incubator/openmeetings/trunk/singlewebapp/WebContent/conf/om_ldap.cfg Thu
May 3 18:31:08 2012
@@ -79,5 +79,10 @@ ldap_user_attr_country=co
ldap_user_attr_town=l
ldap_user_attr_phone=telephoneNumber
+# optional
+# the timezone has to mach an entry in the OpenMeetings table "omtimezones"
otherwise the user will get
+# the timezone defined in the value of the conf_key "default.timezone" in
OpenMeetings "configurations" table
+#ldap_user_timezone=timezone
+
# Ldap ignore upper/lower case, convert all input to lower case
ldap_use_lower_case=false
Modified:
incubator/openmeetings/trunk/singlewebapp/WebContent/conf/sample_openldap_om_ldap.cfg
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/conf/sample_openldap_om_ldap.cfg?rev=1333578&r1=1333577&r2=1333578&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/WebContent/conf/sample_openldap_om_ldap.cfg
(original)
+++
incubator/openmeetings/trunk/singlewebapp/WebContent/conf/sample_openldap_om_ldap.cfg
Thu May 3 18:31:08 2012
@@ -43,3 +43,8 @@ ldap_auth_type=SIMPLE
# Ldap ignore upper/lower case, convert all input to lower case
ldap_use_lower_case=false
+
+# optional
+# the timezone has to mach an entry in the OpenMeetings table "omtimezones"
otherwise the user will get
+# the timezone defined in the value of the conf_key "default.timezone" in
OpenMeetings "configurations" table
+#ldap_user_timezone=timezone
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/basic/dao/OmTimeZoneDaoImpl.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/basic/dao/OmTimeZoneDaoImpl.java?rev=1333578&r1=1333577&r2=1333578&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/basic/dao/OmTimeZoneDaoImpl.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/basic/dao/OmTimeZoneDaoImpl.java
Thu May 3 18:31:08 2012
@@ -87,7 +87,8 @@ public class OmTimeZoneDaoImpl {
public OmTimeZone getOmTimeZone(String jname) {
try {
String hql = "select sl from OmTimeZone as sl "
- + "WHERE sl.jname LIKE :jname";
+ + "WHERE sl.jname LIKE :jname "
+ + "OR sl.ical LIKE :jname";
TypedQuery<OmTimeZone> query = em.createQuery(hql,
OmTimeZone.class);
query.setParameter("jname", jname);
List<OmTimeZone> sList = query.getResultList();
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/installation/ImportInitvalues.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/installation/ImportInitvalues.java?rev=1333578&r1=1333577&r2=1333578&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/installation/ImportInitvalues.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/installation/ImportInitvalues.java
Thu May 3 18:31:08 2012
@@ -20,7 +20,6 @@ package org.openmeetings.app.installatio
import java.io.File;
import java.util.Arrays;
-import java.util.Calendar;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
@@ -455,20 +454,7 @@ public class ImportInitvalues {
// Timezone settings
// ***************************************
- Calendar cal = Calendar.getInstance();
- int offset = cal.get(Calendar.ZONE_OFFSET);
-
- offset = offset / 1000 / 60 / 60;
-
- String timeZoneJavaFormat = "Etc/GMT";
-
- if (offset > 0) {
- timeZoneJavaFormat += "+" + offset;
- } else {
- timeZoneJavaFormat += "-" + offset;
- }
-
- cfgManagement.addConfByKey(3, "default.timezone",
timeZoneJavaFormat,
+ cfgManagement.addConfByKey(3, "default.timezone",
cfg.ical_timeZone,
null, "This is the default timezone if nothing
is specified");
// ***************************************
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/installation/InstallationConfig.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/installation/InstallationConfig.java?rev=1333578&r1=1333577&r2=1333578&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/installation/InstallationConfig.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/installation/InstallationConfig.java
Thu May 3 18:31:08 2012
@@ -7,6 +7,7 @@ public class InstallationConfig {
public static final int USER_PASSWORD_MINIMUM_LENGTH = 4;
public String allowFrontendRegister = "1";
public String createDefaultRooms = "1";
+ public String ical_timeZone = "Europe/Berlin";
public String cryptClassName =
MD5Implementation.class.getCanonicalName();
//email
@@ -86,6 +87,8 @@ public class InstallationConfig {
+ ", sipPhoneRange=" + sipPhoneRange + ",
red5SipEnable="
+ red5SipEnable + ", red5SipRoomPrefix=" +
red5SipRoomPrefix
+ ", red5SipExtenContext=" + red5SipExtenContext
- + ", replyToOrganizer=" + replyToOrganizer +
"]";
+ + ", replyToOrganizer=" + replyToOrganizer
+ + ", ical_timeZone=" + ical_timeZone
+ + "]";
}
}
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/ldap/LdapAuthBase.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/ldap/LdapAuthBase.java?rev=1333578&r1=1333577&r2=1333578&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/ldap/LdapAuthBase.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/ldap/LdapAuthBase.java
Thu May 3 18:31:08 2012
@@ -223,7 +223,6 @@ public class LdapAuthBase {
}
}catch(Exception e){
- log.error("Error occured on LDAP Search : " +
e.getMessage());
log.error("Error occured on LDAP Search : " , e);
}
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/ldap/LdapLoginManagement.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/ldap/LdapLoginManagement.java?rev=1333578&r1=1333577&r2=1333578&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/ldap/LdapLoginManagement.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/ldap/LdapLoginManagement.java
Thu May 3 18:31:08 2012
@@ -31,11 +31,11 @@ import org.openmeetings.app.conference.s
import org.openmeetings.app.data.basic.Configurationmanagement;
import org.openmeetings.app.data.basic.Sessionmanagement;
import org.openmeetings.app.data.basic.dao.LdapConfigDaoImpl;
+import org.openmeetings.app.data.basic.dao.OmTimeZoneDaoImpl;
import org.openmeetings.app.data.user.Statemanagement;
import org.openmeetings.app.data.user.Usermanagement;
import org.openmeetings.app.ldap.config.ConfigReader;
import org.openmeetings.app.persistence.beans.adresses.States;
-import org.openmeetings.app.persistence.beans.basic.Configuration;
import org.openmeetings.app.persistence.beans.basic.LdapConfig;
import org.openmeetings.app.persistence.beans.user.Users;
import org.openmeetings.app.remote.red5.ScopeApplicationAdapter;
@@ -65,6 +65,8 @@ public class LdapLoginManagement {
private Statemanagement statemanagement;
@Autowired
private LdapConfigDaoImpl ldapConfigDao;
+ @Autowired
+ private OmTimeZoneDaoImpl omTimeZoneDaoImpl;
// External User Types
public static final String EXTERNAL_USER_TYPE_LDAP = "LDAP";
@@ -87,6 +89,8 @@ public class LdapLoginManagement {
public static final String CONFIGKEY_LDAP_USE_LOWER_CASE =
"ldap_use_lower_case";
+ public static final String CONFIGKEY_LDAP_TIMEZONE_NAME =
"ldap_user_timezone";
+
/***
* for future use (lemeur) public static final String
* CONFIGKEY_LDAP_USER_EXTRAFILTER = "ldap_user_extrafilter"; public
static
@@ -110,6 +114,7 @@ public class LdapLoginManagement {
public static final String LDAP_KEY_COUNTRY = "co";
public static final String LDAP_KEY_TOWN = "l";
public static final String LDAP_KEY_PHONE = "telephoneNumber";
+ public static final String LDAP_KEY_TIMEZONE = "timezone";
// LDAP custom attribute mapping keys
public static final String CONFIGKEY_LDAP_KEY_LASTNAME =
"ldap_user_attr_lastname";
@@ -316,10 +321,10 @@ public class LdapLoginManagement {
.get(CONFIGKEY_LDAP_KEY_COUNTRY);
String ldap_user_attr_town =
configData.get(CONFIGKEY_LDAP_KEY_TOWN);
String ldap_user_attr_phone =
configData.get(CONFIGKEY_LDAP_KEY_PHONE);
-
+ String ldap_user_attr_timezone =
configData.get(CONFIGKEY_LDAP_TIMEZONE_NAME);
String ldap_use_lower_case =
configData.get(CONFIGKEY_LDAP_USE_LOWER_CASE);
- if (ldap_use_lower_case.equals("true")) {
+ if (ldap_use_lower_case != null &&
ldap_use_lower_case.equals("true")) {
user = user.toLowerCase();
}
@@ -353,6 +358,9 @@ public class LdapLoginManagement {
if (ldap_user_attr_phone == null) {
ldap_user_attr_phone = LDAP_KEY_PHONE;
}
+ if (ldap_user_attr_timezone == null) {
+ ldap_user_attr_timezone = LDAP_KEY_TIMEZONE;
+ }
// Auth Type
String ldap_auth_type =
configData.get(CONFIGKEY_LDAP_AUTH_TYPE);
@@ -445,7 +453,8 @@ public class LdapLoginManagement {
attributes.add(ldap_user_attr_country); // Country
attributes.add(ldap_user_attr_town); // Town
attributes.add(ldap_user_attr_phone); // Phone
-
+ attributes.add(ldap_user_attr_timezone); // Phone
+
HashMap<String, String> ldapAttrs = new HashMap<String,
String>();
ldapAttrs.put("lastnameAttr", ldap_user_attr_lastname);
ldapAttrs.put("firstnameAttr",
ldap_user_attr_firstname);
@@ -457,6 +466,8 @@ public class LdapLoginManagement {
ldapAttrs.put("countryAttr", ldap_user_attr_country);
ldapAttrs.put("townAttr", ldap_user_attr_town);
ldapAttrs.put("phoneAttr", ldap_user_attr_phone);
+ ldapAttrs.put("phoneAttr", ldap_user_attr_phone);
+ ldapAttrs.put("timezoneAttr", ldap_user_attr_timezone);
Vector<HashMap<String, String>> result = lAuth.getData(
ldap_search_scope, ldap_search_filter,
attributes);
@@ -628,6 +639,15 @@ public class LdapLoginManagement {
phone = userdata.get(ldapAttrs.get("phoneAttr"));
long state_id = -1;
+
+ String jName_timeZone = "";
+ if (userdata.containsKey(ldapAttrs.get("timezoneAttr"))
+ && userdata.get(ldapAttrs.get("timezoneAttr"))
!= null)
+ jName_timeZone =
userdata.get(ldapAttrs.get("timezoneAttr"));
+
+ if (omTimeZoneDaoImpl.getOmTimeZone(jName_timeZone) == null) {
+ jName_timeZone =
cfgManagement.getConfValue("default.timezone", String.class, "Europe/Berlin");
+ }
if (state != null) {
// Lookup for states
@@ -662,14 +682,6 @@ public class LdapLoginManagement {
try {
- Configuration conf = cfgManagement.getConfKey(3L,
- "default.timezone");
- String jName_timeZone = "";
-
- if (conf != null) {
- jName_timeZone = conf.getConf_value();
- }
-
// Check if LDAP Users get a SIP Account Issue 1099
newUserId = userManagement.registerUserInit(
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/BackupImportController.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/BackupImportController.java?rev=1333578&r1=1333577&r2=1333578&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/BackupImportController.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/BackupImportController.java
Thu May 3 18:31:08 2012
@@ -819,17 +819,10 @@ public class BackupImportController exte
us.setForceTimeZoneCheck(false);
} else {
- Configuration conf =
cfgManagement.getConfKey(3L,
-
"default.timezone");
- if (conf != null) {
- String
jNameTimeZone = conf.getConf_value();
-
- OmTimeZone
omTimeZone = omTimeZoneDaoImpl
-
.getOmTimeZone(jNameTimeZone);
-
us.setOmTimeZone(omTimeZone);
-
- }
-
+ String jNameTimeZone =
cfgManagement.getConfValue("default.timezone", String.class, "Europe/Berlin");
+ OmTimeZone omTimeZone =
omTimeZoneDaoImpl
+
.getOmTimeZone(jNameTimeZone);
+
us.setOmTimeZone(omTimeZone);
us.setForceTimeZoneCheck(true);
}
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/Install.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/Install.java?rev=1333578&r1=1333577&r2=1333578&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/Install.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/Install.java
Thu May 3 18:31:08 2012
@@ -288,6 +288,7 @@ public class Install extends VelocityVie
cfg.sipPhoneRange =
httpServletRequest.getParameter("sip_phonerange");
String timeZone =
httpServletRequest.getParameter("timeZone");
+ cfg.ical_timeZone = timeZone;
cfg.jodPath =
httpServletRequest.getParameter("jod_path");