openmeetings-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebawag...@apache.org
Subject svn commit: r1442498 - in /openmeetings/trunk/singlewebapp: WebContent/conf/ src/org/apache/openmeetings/data/user/ src/org/apache/openmeetings/data/user/dao/ src/org/apache/openmeetings/ldap/ src/org/apache/openmeetings/persistence/beans/room/
Date Tue, 05 Feb 2013 08:34:28 GMT
Author: sebawagner
Date: Tue Feb  5 08:34:28 2013
New Revision: 1442498

URL: http://svn.apache.org/viewvc?rev=1442498&view=rev
Log:
Adding new config key ldap_user_picture_uri

Modified:
    openmeetings/trunk/singlewebapp/WebContent/conf/om_ldap.cfg
    openmeetings/trunk/singlewebapp/WebContent/conf/sample_openldap_om_ldap.cfg
    openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/Usermanagement.java
    openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/dao/UsersDao.java
    openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
    openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/room/Room.java

Modified: openmeetings/trunk/singlewebapp/WebContent/conf/om_ldap.cfg
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/WebContent/conf/om_ldap.cfg?rev=1442498&r1=1442497&r2=1442498&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/WebContent/conf/om_ldap.cfg (original)
+++ openmeetings/trunk/singlewebapp/WebContent/conf/om_ldap.cfg Tue Feb  5 08:34:28 2013
@@ -79,6 +79,9 @@ ldap_user_attr_country=co
 ldap_user_attr_town=l
 ldap_user_attr_phone=telephoneNumber
 
+# optional, only absolute URLs make sense
+#ldap_user_picture_uri=picture_uri
+
 # 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

Modified: openmeetings/trunk/singlewebapp/WebContent/conf/sample_openldap_om_ldap.cfg
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/WebContent/conf/sample_openldap_om_ldap.cfg?rev=1442498&r1=1442497&r2=1442498&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/WebContent/conf/sample_openldap_om_ldap.cfg (original)
+++ openmeetings/trunk/singlewebapp/WebContent/conf/sample_openldap_om_ldap.cfg Tue Feb  5
08:34:28 2013
@@ -48,3 +48,6 @@ ldap_use_lower_case=false
 # 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
+
+# optional, only absolute URLs make sense
+#ldap_user_picture_uri=picture_uri

Modified: openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/Usermanagement.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/Usermanagement.java?rev=1442498&r1=1442497&r2=1442498&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/Usermanagement.java
(original)
+++ openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/Usermanagement.java
Tue Feb  5 08:34:28 2013
@@ -1549,7 +1549,7 @@ public class Usermanagement {
 	}
 
 	public void updateUser(User user) {
-		usersDao.update(user, 1L);
+		usersDao.update(user);
 	}
 
 	/**

Modified: openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/dao/UsersDao.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/dao/UsersDao.java?rev=1442498&r1=1442497&r2=1442498&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/dao/UsersDao.java
(original)
+++ openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/dao/UsersDao.java
Tue Feb  5 08:34:28 2013
@@ -138,6 +138,17 @@ public class UsersDao implements IDataPr
 		}
 		return u;
 	}
+	
+	public User update(User u) {
+		if (u.getUser_id() == null) {
+			u.setStarttime(new Date());
+			em.persist(u);
+		} else {
+			u.setUpdatetime(new Date());
+			u =	em.merge(u);
+		}
+		return u;
+	}
 
 	public void delete(User u, long userId) {
 		deleteUserID(u.getUser_id());

Modified: openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java?rev=1442498&r1=1442497&r2=1442498&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
(original)
+++ openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
Tue Feb  5 08:34:28 2013
@@ -36,10 +36,10 @@ import org.apache.openmeetings.data.user
 import org.apache.openmeetings.data.user.dao.UsersDao;
 import org.apache.openmeetings.ldap.config.ConfigReader;
 import org.apache.openmeetings.persistence.beans.basic.LdapConfig;
+import org.apache.openmeetings.persistence.beans.room.Client;
 import org.apache.openmeetings.persistence.beans.user.State;
 import org.apache.openmeetings.persistence.beans.user.User;
 import org.apache.openmeetings.remote.util.SessionVariablesUtil;
-import org.apache.openmeetings.persistence.beans.room.Client;
 import org.apache.openmeetings.utils.OmFileHelper;
 import org.apache.openmeetings.utils.crypt.ManageCryptStyle;
 import org.red5.logging.Red5LoggerFactory;
@@ -121,6 +121,7 @@ public class LdapLoginManagement {
 	public static final String LDAP_KEY_TOWN = "l";
 	public static final String LDAP_KEY_PHONE = "telephoneNumber";
 	public static final String LDAP_KEY_TIMEZONE = "timezone";
+	public static final String LDAP_KEY_PICTURE_URI = "pictureUri";
 
 	// LDAP custom attribute mapping keys
 	public static final String CONFIGKEY_LDAP_KEY_LASTNAME = "ldap_user_attr_lastname";
@@ -133,6 +134,7 @@ public class LdapLoginManagement {
 	public static final String CONFIGKEY_LDAP_KEY_COUNTRY = "ldap_user_attr_country";
 	public static final String CONFIGKEY_LDAP_KEY_TOWN = "ldap_user_attr_town";
 	public static final String CONFIGKEY_LDAP_KEY_PHONE = "ldap_user_attr_phone";
+	public static final String CONFIGKEY_LDAP_PICTURE_URI = "ldap_user_picture_uri";
 
 	/**
 	 * Determine if is a supported Auth Type
@@ -319,8 +321,10 @@ public class LdapLoginManagement {
 		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_user_picture_uri = configData.get(CONFIGKEY_LDAP_PICTURE_URI);
 		String ldap_use_lower_case = configData.get(CONFIGKEY_LDAP_USE_LOWER_CASE);
 		
+		
 		if (ldap_use_lower_case != null && ldap_use_lower_case.equals("true")) {
 			user = user.toLowerCase();
 		}
@@ -358,6 +362,9 @@ public class LdapLoginManagement {
 		if (ldap_user_attr_timezone == null) {
 			ldap_user_attr_timezone = LDAP_KEY_TIMEZONE;
 		}
+		if (ldap_user_picture_uri == null) {
+			ldap_user_picture_uri = LDAP_KEY_PICTURE_URI;
+		}
 
 		// Auth Type
 		String ldap_auth_type = configData.get(CONFIGKEY_LDAP_AUTH_TYPE);
@@ -450,7 +457,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
+			attributes.add(ldap_user_attr_timezone); // timezone
+			attributes.add(ldap_user_picture_uri); //picture uri
 			
 			HashMap<String, String> ldapAttrs = new HashMap<String, String>();
 			ldapAttrs.put("lastnameAttr", ldap_user_attr_lastname);
@@ -463,8 +471,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);
+			ldapAttrs.put("pictureUri", ldap_user_picture_uri);
 
 			Vector<HashMap<String, String>> result = lAuth.getData(
 					ldap_search_scope, ldap_search_filter, attributes);
@@ -634,6 +642,11 @@ public class LdapLoginManagement {
 		if (userdata.containsKey(ldapAttrs.get("phoneAttr"))
 				&& userdata.get(ldapAttrs.get("phoneAttr")) != null)
 			phone = userdata.get(ldapAttrs.get("phoneAttr"));
+		
+		String pictureUri = "pictureUri";
+		if (userdata.containsKey(ldapAttrs.get("pictureUri"))
+				&& userdata.get(ldapAttrs.get("pictureUri")) != null)
+			pictureUri = userdata.get(ldapAttrs.get("pictureUri"));
 
 		long state_id = -1;
 		
@@ -710,6 +723,10 @@ public class LdapLoginManagement {
 					false, //showContactData
 					true //showContactDataToContacts
 					);
+			
+			User user = usersDao.get(newUserId);
+			user.setPictureuri(pictureUri);
+			usersDao.update(user);
 
 		} catch (Exception e) {
 			log.error("Error creating user : " + e.getMessage());

Modified: openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/room/Room.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/room/Room.java?rev=1442498&r1=1442497&r2=1442498&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/room/Room.java
(original)
+++ openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/room/Room.java
Tue Feb  5 08:34:28 2013
@@ -42,6 +42,7 @@ import javax.persistence.Table;
 import javax.persistence.Transient;
 
 import org.apache.openjpa.persistence.ElementDependent;
+import org.apache.openjpa.persistence.jdbc.ForeignKey;
 import org.apache.openmeetings.persistence.beans.IDataProviderEntity;
 import org.apache.openmeetings.persistence.beans.sip.asterisk.MeetMe;
 import org.simpleframework.xml.Element;
@@ -97,6 +98,7 @@ public class Room implements Serializabl
 
 	@ManyToOne(fetch = FetchType.EAGER)
 	@JoinColumn(name = "roomtypes_id")
+	@ForeignKey(enabled = true)
 	@Element(name = "roomtypeId", data = true, required = false)
 	private RoomType roomtype;
 



Mime
View raw message