Author: bdaw
Date: 2007-05-18 03:31:11 -0400 (Fri, 18 May 2007)
New Revision: 7272
Added:
trunk/identity/src/etc/opends/
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
trunk/identity/build.xml
trunk/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java
Log:
- correct handling of CachedUserImpl by DelegatingUserProfileModuleImpl and usage of
reg.getUser() in UserPortlet
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-05-18
04:04:41 UTC (rev 7271)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-05-18
07:31:11 UTC (rev 7272)
@@ -266,6 +266,14 @@
else
{
user = req.getUser();
+ try
+ {
+ user = userModule.findUserById(user.getId());
+ }
+ catch (IdentityException e)
+ {
+ log.error("Cannot retrive user", e);
+ }
}
// Validate we have a user object
@@ -849,6 +857,15 @@
public void storeProfile(JBossActionRequest req, JBossActionResponse resp) throws
PortletException
{
User currentUser = req.getUser();
+ try
+ {
+ currentUser = userModule.findUserById(currentUser.getId());
+ }
+ catch (IdentityException e)
+ {
+ log.error("Cannot retrive user", e);
+ }
+
if (currentUser == null)
{
throw new PortletException("No user");
Modified: trunk/identity/build.xml
===================================================================
--- trunk/identity/build.xml 2007-05-18 04:04:41 UTC (rev 7271)
+++ trunk/identity/build.xml 2007-05-18 07:31:11 UTC (rev 7272)
@@ -112,6 +112,7 @@
<path refid="jboss.portal-test.classpath"/>
<path refid="jboss.portal-common.classpath"/>
<path refid="jboss.portal-jems.classpath"/>
+ <path refid="jboss.portal-core.classpath"/>
</path>
<!--+=======================================+-->
Modified:
trunk/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java 2007-05-18
04:04:41 UTC (rev 7271)
+++
trunk/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java 2007-05-18
07:31:11 UTC (rev 7272)
@@ -28,6 +28,7 @@
import org.jboss.portal.identity.db.HibernateUserImpl;
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.core.controller.portlet.CachedUserImpl;
import javax.naming.InitialContext;
@@ -81,9 +82,16 @@
{
throw new IdentityException("Such property name is not supported: "
+ propertyName);
}
- else if (property.isMappedLDAP() && isLDAPSupported() && user
instanceof LDAPUserImpl)
+
+ if (user instanceof CachedUserImpl)
{
+ user = obtainUser(user);
+ }
+
+ if (property.isMappedLDAP() && isLDAPSupported() && user
instanceof LDAPUserImpl)
+ {
log.debug("Delegating to LDAP module");
+
return getLDAPModule().getProperty(user, propertyName);
}
else if (property.isMappedDB())
@@ -109,8 +117,14 @@
{
throw new IdentityException("Such property name is not supported: "
+ name);
}
- else if (property.isMappedLDAP() && isLDAPSupported() && user
instanceof LDAPUserImpl)
+
+ if (user instanceof CachedUserImpl)
{
+ user = obtainUser(user);
+ }
+
+ if (property.isMappedLDAP() && isLDAPSupported() && user
instanceof LDAPUserImpl)
+ {
log.debug("Delegating to LDAP module");
getLDAPModule().setProperty(user, name, propertyValue);
return;
@@ -135,6 +149,11 @@
if (log.isDebugEnabled()) log.debug("getProperties");//: " + name +
"/" + propertyValue)
try
{
+ if (user instanceof CachedUserImpl)
+ {
+ user = obtainUser(user);
+ }
+
if (user instanceof LDAPUserImpl && isLDAPSupported())
{
log.debug("handling LDAP user implementation");
@@ -174,7 +193,13 @@
}
}
+ private User obtainUser(User user) throws IdentityException
+ {
+ UserModule um =
(UserModule)getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
+ return um.findUserById(user.getId());
+ }
+
public ProfileInfo getProfileInfo() throws IdentityException
{
return profileInfo;
Show replies by date