JBoss Portal SVN: r9078 - branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-11-22 18:45:10 -0500 (Thu, 22 Nov 2007)
New Revision: 9078
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
Log:
Rollback till i learn how to write a correct DTD...
Modified: branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2007-11-22 22:21:48 UTC (rev 9077)
+++ branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2007-11-22 23:45:10 UTC (rev 9078)
@@ -158,7 +158,7 @@
type page and window. The children windows are the windows of the page and the children
pages are the subpages of this page.
-->
-<!ELEMENT page (page-name,properties?,listener?,security-constraint?,(page|window)*,(display-name|resource-bundle,supported-locale+)>
+<!ELEMENT page (page-name,properties?,listener?,security-constraint?,(page|window)*)>
<!ELEMENT display-name (#PCDATA)>
<!ATTLIST display-name
16 years, 7 months
JBoss Portal SVN: r9077 - in branches/JBoss_Portal_Branch_2_6: core/src/main/org/jboss/portal/core/model/portal/metadata and 3 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-11-22 17:21:48 -0500 (Thu, 22 Nov 2007)
New Revision: 9077
Modified:
branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-weather-samples-war/WEB-INF/classes/WeatherResource.properties
branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-weather-samples-war/WEB-INF/classes/WeatherResource_fr.properties
branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-weather-samples-war/WEB-INF/default-object.xml
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeployment.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/metadata/BuildContext.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/metadata/PortalObjectMetaData.java
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
Log:
Alternatively use resource bundles instead of display-name in -object.xml
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeployment.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeployment.java 2007-11-22 14:10:45 UTC (rev 9076)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeployment.java 2007-11-22 22:21:48 UTC (rev 9077)
@@ -110,6 +110,7 @@
// Load xml document
log.debug("Loading portal metadata from " + url);
in = IOTools.safeBufferedWrapper(url.openStream());
+
DocumentBuilder builder = XMLTools.getDocumentBuilderFactory().newDocumentBuilder();
EntityResolver entityResolver = factory.getPortalObjectEntityResolver();
if (entityResolver == null)
@@ -132,7 +133,7 @@
{
Element deploymentElt = (Element)deploymentElts.get(i);
Unit unit = new Unit();
-
+
//
Element parentRefElt = XMLTools.getUniqueChild(deploymentElt, "parent-ref", false);
unit.parentRef = parentRefElt == null ? null : PortalObjectId.parse(XMLTools.asString(parentRefElt), PortalObjectPath.LEGACY_FORMAT);
@@ -154,7 +155,7 @@
}
// The object to create
- Object metaData = null;
+ PortalObjectMetaData metaData = null;
//
Element metaDataElt = XMLTools.getUniqueChild(deploymentElt, "portal", false);
@@ -200,6 +201,11 @@
ContentProvider contentProvider = factory.contentProviderRegistry.getContentProvider(contentType);
return contentProvider != null ? contentProvider.getHandler() : null;
}
+
+ public PortalWebApp getPortalWebApp()
+ {
+ return pwa;
+ }
};
// Create all objects
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/metadata/BuildContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/metadata/BuildContext.java 2007-11-22 14:10:45 UTC (rev 9076)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/metadata/BuildContext.java 2007-11-22 22:21:48 UTC (rev 9077)
@@ -25,6 +25,7 @@
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.content.spi.handler.ContentHandler;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.server.deployment.PortalWebApp;
/**
* Defines the callbacks for creating a portal object.
@@ -37,4 +38,6 @@
PortalObjectContainer getContainer();
ContentHandler getContentHandler(ContentType contentType);
+
+ PortalWebApp getPortalWebApp();
}
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/metadata/PortalObjectMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/metadata/PortalObjectMetaData.java 2007-11-22 14:10:45 UTC (rev 9076)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/metadata/PortalObjectMetaData.java 2007-11-22 22:21:48 UTC (rev 9077)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.core.model.portal.metadata;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -31,6 +32,7 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.i18n.LocaleFormat;
import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.common.i18n.ResourceBundleManager;
import org.jboss.portal.common.util.ConversionException;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.xml.XMLTools;
@@ -39,6 +41,8 @@
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.PortalObjectPath;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.portlet.impl.jsr168.PortletResourceBundleFactory;
+import org.jboss.portal.portlet.impl.jsr168.metadata.LanguagesMetaData;
import org.jboss.portal.security.RoleSecurityBinding;
import org.jboss.portal.security.SecurityConstants;
import org.jboss.portal.security.metadata.SecurityConstraintsMetaData;
@@ -61,6 +65,8 @@
private Map children;
private SecurityConstraintsMetaData securityConstraints;
private LocalizedString displayName;
+ private String resourceBundle;
+ private List supportedLocales;
public PortalObjectMetaData()
{
@@ -140,7 +146,7 @@
{
// Build instance
PortalObject object = newInstance(buildContext, parent);
-
+
// Configure common properties
configure(buildContext, object);
@@ -177,6 +183,21 @@
// Configure listener
object.setListener(listener);
+
+ if (resourceBundle != null)
+ {
+ LanguagesMetaData md = new LanguagesMetaData();
+ md.setResourceBundle(resourceBundle);
+ Iterator it = supportedLocales.iterator();
+ while (it.hasNext())
+ {
+ Locale locale = (Locale)it.next();
+ md.getSupportedLocales().add(locale);
+ }
+
+ ResourceBundleManager bundleMgr = PortletResourceBundleFactory.createResourceBundleManager(buildContext.getPortalWebApp().getClassLoader(), md);
+ object.setDisplayName(bundleMgr.getLocalizedValue("org.jboss.portal.object.name." + object.getId().getPath().toString(PortalObjectPath.LEGACY_FORMAT), object.getName()));
+ }
// Configure display name
if (displayName != null)
@@ -269,8 +290,18 @@
{
buildListenerMetaData(portalObjectMD, listenerElt);
}
-
- buildDisplayNameMetaData(portalObjectMD, portalObjectElt);
+
+ // Configure resource-bundle
+ Element resourceBundleElt = XMLTools.getUniqueChild(portalObjectElt, "resource-bundle", false);
+ if (resourceBundleElt != null)
+ {
+ buildResourceBundleMetaData(portalObjectMD, resourceBundleElt);
+ buildSupportedLocalesMetaData(portalObjectMD, portalObjectElt);
+ }
+ else
+ {
+ buildDisplayNameMetaData(portalObjectMD, portalObjectElt);
+ }
}
return portalObjectMD;
}
@@ -317,17 +348,56 @@
portalObjectMD.setDisplayName(new LocalizedString(localizedStringValues, Locale.ENGLISH));
}
}
-
+ public static void buildSupportedLocalesMetaData(PortalObjectMetaData portalObjectMD, Element portalObjectElt)
+ {
+ Iterator supportedLocalesIt = XMLTools.getChildrenIterator(portalObjectElt, "supported-locale");
+
+ List supportedLocales = new ArrayList();
+ while (supportedLocalesIt.hasNext())
+ {
+ Element element = (Element)supportedLocalesIt.next();
+ supportedLocales.add(new Locale(element.getTextContent()));
+ }
+ portalObjectMD.setSupportedLocales(supportedLocales);
+ }
+
+
public static void buildListenerMetaData(PortalObjectMetaData portalObjectMD, Element listenerElt)
{
String listener = XMLTools.asString(listenerElt);
portalObjectMD.setListener(listener);
}
+ public static void buildResourceBundleMetaData(PortalObjectMetaData portalObjectMD, Element resourceBundleElt)
+ {
+ String resourceBundle = XMLTools.asString(resourceBundleElt);
+ portalObjectMD.setResourceBundle(resourceBundle);
+ }
+
public String toString()
{
String name = getClass().getName();
return Tools.getShortNameOf(getClass()) + "[" + name + "]";
}
+
+ public String getResourceBundle()
+ {
+ return resourceBundle;
+ }
+
+ public void setResourceBundle(String resourceBundle)
+ {
+ this.resourceBundle = resourceBundle;
+ }
+
+ public List getSupportedLocales()
+ {
+ return supportedLocales;
+ }
+
+ public void setSupportedLocales(List supportedLocales)
+ {
+ this.supportedLocales = supportedLocales;
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2007-11-22 14:10:45 UTC (rev 9076)
+++ branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2007-11-22 22:21:48 UTC (rev 9077)
@@ -158,8 +158,17 @@
type page and window. The children windows are the windows of the page and the children
pages are the subpages of this page.
-->
-<!ELEMENT page (page-name,properties?,listener?,security-constraint?,(page|window)*)>
+<!ELEMENT page (page-name,properties?,listener?,security-constraint?,(page|window)*,(display-name|resource-bundle,supported-locale+)>
+<!ELEMENT display-name (#PCDATA)>
+<!ATTLIST display-name
+ xml:lang NMTOKEN #IMPLIED
+>
+
+<!ELEMENT resource-bundle (#PCDATA)>
+
+<!ELEMENT supported-locale (#PCDATA)>
+
<!--
The page name value.
-->
Modified: branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-weather-samples-war/WEB-INF/classes/WeatherResource.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-weather-samples-war/WEB-INF/classes/WeatherResource.properties 2007-11-22 14:10:45 UTC (rev 9076)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-weather-samples-war/WEB-INF/classes/WeatherResource.properties 2007-11-22 22:21:48 UTC (rev 9077)
@@ -23,3 +23,4 @@
javax.portlet.preference.name.RssXml=RSS feed URL
javax.portlet.preference.name.expires=Expiration time
+org.jboss.portal.object.name.Weather=Weather
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-weather-samples-war/WEB-INF/classes/WeatherResource_fr.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-weather-samples-war/WEB-INF/classes/WeatherResource_fr.properties 2007-11-22 14:10:45 UTC (rev 9076)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-weather-samples-war/WEB-INF/classes/WeatherResource_fr.properties 2007-11-22 22:21:48 UTC (rev 9077)
@@ -23,3 +23,4 @@
javax.portlet.preference.name.RssXml=URL du flux RSS
javax.portlet.preference.name.expires=Temps d'expiration
+org.jboss.portal.object.name.default.Weather=M\u00E9t\u00E9o
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-weather-samples-war/WEB-INF/default-object.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-weather-samples-war/WEB-INF/default-object.xml 2007-11-22 14:10:45 UTC (rev 9076)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-weather-samples-war/WEB-INF/default-object.xml 2007-11-22 22:21:48 UTC (rev 9077)
@@ -29,9 +29,12 @@
<deployments>
<deployment>
<parent-ref>default</parent-ref>
- <if-exists>keep</if-exists>
+ <if-exists>overwrite</if-exists>
<page>
<page-name>Weather</page-name>
+ <supported-locale>fr</supported-locale>
+ <supported-locale>en</supported-locale>
+ <resource-bundle>WeatherResource</resource-bundle>
<properties>
<property>
<name>order</name>
16 years, 7 months
JBoss Portal SVN: r9076 - branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/wizard.
by portal-commits@lists.jboss.org
Author: emuckenhuber
Date: 2007-11-22 09:10:45 -0500 (Thu, 22 Nov 2007)
New Revision: 9076
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/wizard/newWindowWizardConfirm.xhtml
Log:
fixed the portlet name in the wizard
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/wizard/newWindowWizardConfirm.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/wizard/newWindowWizardConfirm.xhtml 2007-11-22 13:27:44 UTC (rev 9075)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/wizard/newWindowWizardConfirm.xhtml 2007-11-22 14:10:45 UTC (rev 9076)
@@ -11,7 +11,7 @@
<table>
<tr>
<td><b>Portlet:</b></td>
- <td>#{newWindowWizard.selectedPortlet.name.defaultString}</td>
+ <td>#{newWindowWizard.selectedPortlet.name}</td>
</tr>
<tr>
<td><b>Portal:</b></td>
16 years, 7 months
JBoss Portal SVN: r9075 - branches/presentation/presentation/src/main/org/jboss/portal/presentation/model.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-22 08:27:44 -0500 (Thu, 22 Nov 2007)
New Revision: 9075
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIContext.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIObject.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIWindow.java
Log:
methods on interface are public implicitely, no need to be explicit
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIContext.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIContext.java 2007-11-22 10:44:22 UTC (rev 9074)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIContext.java 2007-11-22 13:27:44 UTC (rev 9075)
@@ -36,11 +36,11 @@
* @param id
* @return
*/
- public UIObject getObject(String id);
+ UIObject getObject(String id);
/**
*
* @return
*/
- public ModelLoader getModelLoader();
+ ModelLoader getModelLoader();
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIObject.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIObject.java 2007-11-22 10:44:22 UTC (rev 9074)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIObject.java 2007-11-22 13:27:44 UTC (rev 9075)
@@ -34,21 +34,21 @@
*
* @return
*/
- public String getId();
+ String getId();
/**
*
* @return
*/
- public String getName();
+ String getName();
/**
*
* @return
*/
- public UIObject getParent();
+ UIObject getParent();
- public UIObject getChild(String name);
+ UIObject getChild(String name);
/**
* Create a child with a specified type.
@@ -70,7 +70,7 @@
*
* @return
*/
- public List<UIObject> getChildren();
+ List<UIObject> getChildren();
/**
*
@@ -78,5 +78,5 @@
* @param type
* @return
*/
- public <T extends UIObject> List<T> getChildren(Class<T> type);
+ <T extends UIObject> List<T> getChildren(Class<T> type);
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIWindow.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIWindow.java 2007-11-22 10:44:22 UTC (rev 9074)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIWindow.java 2007-11-22 13:27:44 UTC (rev 9075)
@@ -35,27 +35,27 @@
*
* @return
*/
- public WindowState getWindowState();
+ WindowState getWindowState();
/**
*
* @param windowState
*/
- public void setWindowState(WindowState windowState);
+ void setWindowState(WindowState windowState);
/**
*
* @return
*/
- public Mode getMode();
+ Mode getMode();
/**
*
* @param mode
*/
- public void setMode(Mode mode);
+ void setMode(Mode mode);
- public Object getContentState();
+ Object getContentState();
void setContentState(Object contentState);
}
16 years, 7 months
JBoss Portal SVN: r9074 - in branches/JBoss_Portal_Branch_2_6/core-identity/src: main/org/jboss/portal/core/identity/ui/actions and 4 other directories.
by portal-commits@lists.jboss.org
Author: emuckenhuber
Date: 2007-11-22 05:44:22 -0500 (Thu, 22 Nov 2007)
New Revision: 9074
Modified:
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityUIUser.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/AssignRoleAction.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/LostPasswordAction.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/RoleManagementBean.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java
branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles/roleMembers.xhtml
branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/searchUsers.xhtml
branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/userInfo.xhtml
Log:
JBPORTAL-1732: utf8 encoding for params
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityUIUser.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityUIUser.java 2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityUIUser.java 2007-11-22 10:44:22 UTC (rev 9074)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.identity.ui;
+import org.jboss.portal.common.text.FastURLEncoder;
+
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
@@ -74,13 +76,8 @@
return attribute;
}
- /**
- * Used for GET parameters - username does never contain a escape char
- *
- * @return double escaped username
- */
- public String getEscapedUsername()
+ public String getUTF8Username()
{
- return username.replace("\\", "\\\\");
+ return FastURLEncoder.getUTF8Instance().encode(username);
}
}
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/AssignRoleAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/AssignRoleAction.java 2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/AssignRoleAction.java 2007-11-22 10:44:22 UTC (rev 9074)
@@ -30,6 +30,7 @@
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import org.jboss.portal.common.text.FastURLDecoder;
import org.jboss.portal.core.identity.ui.IdentityUIUser;
import org.jboss.portal.core.identity.ui.common.IdentityRoleBean;
import org.jboss.portal.core.identity.ui.common.IdentityUserBean;
@@ -56,6 +57,9 @@
/** .*/
private IdentityRoleBean identityRoleBean;
+
+ /** . */
+ private final static FastURLDecoder decoder = FastURLDecoder.getUTF8Instance();
public IdentityUIUser getUiUser()
{
@@ -102,7 +106,7 @@
FacesContext ctx = FacesContext.getCurrentInstance();
ExternalContext ectx = ctx.getExternalContext();
Map params = ectx.getRequestParameterMap();
- this.currentUser = (String) params.get("currentUser");
+ this.currentUser = decoder.encode((String) params.get("currentUser"));
if (this.currentUser != null)
{
this.uiUser = new IdentityUIUser(this.currentUser);
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java 2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java 2007-11-22 10:44:22 UTC (rev 9074)
@@ -35,6 +35,7 @@
import org.jboss.logging.Logger;
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.api.node.PortalNodeURL;
+import org.jboss.portal.common.text.FastURLDecoder;
import org.jboss.portal.core.identity.services.IdentityConstants;
import org.jboss.portal.core.identity.services.workflow.ValidateEmailService;
import org.jboss.portal.core.identity.ui.IdentityUIUser;
@@ -72,6 +73,8 @@
/** . */
private ValidateEmailService validateEmailService;
+
+ private final static FastURLDecoder decoder = FastURLDecoder.getUTF8Instance();
/** . */
private static final Logger log = Logger.getLogger(EditProfileAction.class);
@@ -201,7 +204,7 @@
FacesContext ctx = FacesContext.getCurrentInstance();
ExternalContext ectx = ctx.getExternalContext();
Map params = ectx.getRequestParameterMap();
- this.currentUser = (String) params.get("currentUser");
+ this.currentUser = decoder.encode((String) params.get("currentUser"));
this.windowState = null;
if (this.currentUser == null)
{
@@ -267,7 +270,7 @@
FacesContext ctx = FacesContext.getCurrentInstance();
ExternalContext ectx = ctx.getExternalContext();
Map params = ectx.getRequestParameterMap();
- this.currentUser = (String) params.get("currentUser");
+ this.currentUser = decoder.encode((String) params.get("currentUser"));
return "adminChangePassword";
}
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java 2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java 2007-11-22 10:44:22 UTC (rev 9074)
@@ -27,6 +27,7 @@
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import org.jboss.portal.common.text.FastURLDecoder;
import org.jboss.portal.core.identity.ui.UIRole;
import org.jboss.portal.core.identity.ui.common.IdentityRoleBean;
@@ -45,6 +46,9 @@
/** .*/
private IdentityRoleBean identityRoleBean;
+
+ /** . */
+ private static final FastURLDecoder decoder = FastURLDecoder.getUTF8Instance();
public UIRole getUiRole()
{
@@ -71,7 +75,7 @@
FacesContext ctx = FacesContext.getCurrentInstance();
ExternalContext ectx = ctx.getExternalContext();
Map params = ectx.getRequestParameterMap();
- this.currentRole = (String) params.get("currentRole");
+ this.currentRole = decoder.encode((String) params.get("currentRole"));
try
{
this.uiRole = identityRoleBean.getUIRole(this.currentRole);
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/LostPasswordAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/LostPasswordAction.java 2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/LostPasswordAction.java 2007-11-22 10:44:22 UTC (rev 9074)
@@ -34,6 +34,7 @@
import javax.faces.context.FacesContext;
import org.jboss.logging.Logger;
+import org.jboss.portal.common.text.FastURLDecoder;
import org.jboss.portal.core.identity.services.IdentityConstants;
import org.jboss.portal.core.identity.services.IdentityMailService;
import org.jboss.portal.core.identity.ui.IdentityUIUser;
@@ -64,6 +65,9 @@
/** . */
private static final Logger log = Logger.getLogger(LostPasswordAction.class);
+
+ /** . */
+ private static final FastURLDecoder decoder = FastURLDecoder.getUTF8Instance();
public String getUsername()
{
@@ -185,7 +189,7 @@
FacesContext ctx = FacesContext.getCurrentInstance();
ExternalContext ectx = ctx.getExternalContext();
Map params = ectx.getRequestParameterMap();
- this.username = (String) params.get("currentUser");
+ this.username = decoder.encode((String) params.get("currentUser"));
return "resetPassword";
}
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/RoleManagementBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/RoleManagementBean.java 2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/RoleManagementBean.java 2007-11-22 10:44:22 UTC (rev 9074)
@@ -36,6 +36,7 @@
import javax.faces.model.ListDataModel;
import org.jboss.logging.Logger;
+import org.jboss.portal.common.text.FastURLDecoder;
import org.jboss.portal.core.identity.ui.IdentityUIUser;
import org.jboss.portal.core.identity.ui.UIRole;
import org.jboss.portal.core.identity.ui.common.IdentityRoleBean;
@@ -72,6 +73,9 @@
/** The logger */
private static final Logger log = Logger.getLogger(RoleManagementBean.class);
+
+ /** The decoder */
+ private static final FastURLDecoder decoder = FastURLDecoder.getUTF8Instance();
public IdentityRoleBean getIdentityRoleBean()
{
@@ -150,7 +154,7 @@
FacesContext ctx = FacesContext.getCurrentInstance();
ExternalContext ectx = ctx.getExternalContext();
Map params = ectx.getRequestParameterMap();
- String role = (String) params.get("currentRole");
+ String role = decoder.encode((String) params.get("currentRole"));
this.currentRole = role != null ? role : this.currentRole;
try
{
@@ -207,7 +211,7 @@
FacesContext ctx = FacesContext.getCurrentInstance();
ExternalContext ectx = ctx.getExternalContext();
Map params = ectx.getRequestParameterMap();
- this.currentRole = (String) params.get("currentRole");
+ this.currentRole = decoder.encode((String) params.get("currentRole"));
if (this.currentRole != null)
{
try
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java 2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java 2007-11-22 10:44:22 UTC (rev 9074)
@@ -36,6 +36,7 @@
import javax.faces.model.ListDataModel;
import org.jboss.logging.Logger;
+import org.jboss.portal.common.text.FastURLDecoder;
import org.jboss.portal.core.identity.services.IdentityConstants;
import org.jboss.portal.core.identity.services.metadata.CoreIdentityConfigurationException;
import org.jboss.portal.core.identity.services.workflow.RegistrationService;
@@ -105,6 +106,9 @@
/** . */
private static final Logger log = Logger.getLogger(UserAdministrationBean.class);
+
+ /** The decoder */
+ private static final FastURLDecoder decoder = FastURLDecoder.getUTF8Instance();
public UserAdministrationBean()
{
@@ -257,7 +261,7 @@
ExternalContext ectx = ctx.getExternalContext();
Map params = ectx.getRequestParameterMap();
String action = (String) params.get("enableAction");
- this.currentUser = (String) params.get("currentUser");
+ this.currentUser = decoder.encode((String) params.get("currentUser"));
// TODO - do something better than .equals("admin")
if (this.currentUser != null && action != null && ! this.currentUser.equals("admin"))
@@ -344,7 +348,7 @@
FacesContext ctx = FacesContext.getCurrentInstance();
ExternalContext ectx = ctx.getExternalContext();
Map params = ectx.getRequestParameterMap();
- this.currentUser = (String) params.get("currentUser");
+ this.currentUser = decoder.encode((String) params.get("currentUser"));
if (this.currentUser != null)
{
this.uiUser = new IdentityUIUser(this.currentUser);
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles/roleMembers.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles/roleMembers.xhtml 2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles/roleMembers.xhtml 2007-11-22 10:44:22 UTC (rev 9074)
@@ -64,11 +64,11 @@
</f:facet>
<h:commandLink action="#{editprofilemgr.adminEditProfile}" styleClass="actionRename">
<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_ACTION_EDIT_PROFILE}"/>
- <f:param name="currentUser" value="#{uiUser.escapedUsername}"/>
+ <f:param name="currentUser" value="#{uiUser.UTF8Username}"/>
</h:commandLink> |
<h:commandLink action="#{assignrolemgr.assignRoles}" styleClass="actionPreferences">
<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_ACTION_ROLES}"/>
- <f:param name="currentUser" value="#{uiUser.escapedUsername}"/>
+ <f:param name="currentUser" value="#{uiUser.UTF8Username}"/>
</h:commandLink>
</h:column>
</h:dataTable>
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/searchUsers.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/searchUsers.xhtml 2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/searchUsers.xhtml 2007-11-22 10:44:22 UTC (rev 9074)
@@ -74,20 +74,20 @@
</f:facet>
<h:commandLink action="#{editprofilemgr.adminEditProfile}" styleClass="actionRename">
<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_ACTION_EDIT_PROFILE}"/>
- <f:param name="currentUser" value="#{uiUser.escapedUsername}"/>
+ <f:param name="currentUser" value="#{uiUser.UTF8Username}"/>
</h:commandLink> |
<h:commandLink action="#{assignrolemgr.assignRoles}" styleClass="actionProperties">
<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_ACTION_ROLES}"/>
- <f:param name="currentUser" value="#{uiUser.escapedUsername}"/>
+ <f:param name="currentUser" value="#{uiUser.UTF8Username}"/>
</h:commandLink> |
<h:commandLink action="#{useradministrationbean.enableUser}" styleClass="#{uiUser.attribute.enabled == true ? 'actionDefault' : 'actionMakeDefault'}">
<h:outputText value="#{uiUser.attribute.enabled == true ? bundle.IDENTITY_MANAGEMENT_DISABLE : bundle.IDENTITY_MANAGEMENT_ENABLE}" />
- <f:param name="currentUser" value="#{uiUser.escapedUsername}"/>
+ <f:param name="currentUser" value="#{uiUser.UTF8Username}"/>
<f:param name="enableAction" value="#{uiUser.attribute.enabled == true ? 'disable' : 'enable'}" />
</h:commandLink> |
<h:commandLink action="#{useradministrationbean.deleteUser}" styleClass="actionDelete">
<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_ACTION_DELETE}"/>
- <f:param name="currentUser" value="#{uiUser.escapedUsername}"/>
+ <f:param name="currentUser" value="#{uiUser.UTF8Username}"/>
</h:commandLink>
</h:column>
</h:dataTable>
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/userInfo.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/userInfo.xhtml 2007-11-22 09:24:02 UTC (rev 9073)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/userInfo.xhtml 2007-11-22 10:44:22 UTC (rev 9074)
@@ -50,7 +50,7 @@
<h:outputText value="#{bundle.IDENTITY_PASSWORD}"/>
<h:commandLink action="#{lostpasswordmgr.adminResetPassword}">
<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_RESET_PASSWORD}" />
- <f:param name="currentUser" value="#{manager.uiUser.escapedUsername}" />
+ <f:param name="currentUser" value="#{manager.uiUser.UTF8Username}" />
</h:commandLink>
<h:panelGroup />
</c:when>
@@ -58,7 +58,7 @@
<h:outputText value="#{bundle.IDENTITY_PASSWORD}"/>
<h:commandLink action="#{manager.adminChangePassword}">
<h:outputText value="#{bundle.IDENTITY_EDIT_CHANGE_PASSWORD}" />
- <f:param name="currentUser" value="#{manager.uiUser.escapedUsername}" />
+ <f:param name="currentUser" value="#{manager.uiUser.UTF8Username}" />
</h:commandLink>
<h:panelGroup />
</c:otherwise>
@@ -81,7 +81,7 @@
<h:outputText value="#{bundle.IDENTITY_PASSWORD}"/>
<h:commandLink action="changePassword">
<h:outputText value="#{bundle.IDENTITY_EDIT_CHANGE_PASSWORD}" />
- <f:param name="currentUser" value="#{manager.uiUser.escapedUsername}" />
+ <f:param name="currentUser" value="#{manager.uiUser.UTF8Username}" />
</h:commandLink>
<h:panelGroup />
</c:otherwise>
16 years, 7 months
JBoss Portal SVN: r9073 - in modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity: ldap and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-11-22 04:24:02 -0500 (Thu, 22 Nov 2007)
New Revision: 9073
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java
Log:
Add 'allowEmptyPasswords' option in identity configuration
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java 2007-11-22 08:34:22 UTC (rev 9072)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java 2007-11-22 09:24:02 UTC (rev 9073)
@@ -69,6 +69,8 @@
public static final String USER_SEARCH_FILTER = "userSearchFilter";
+ public static final String USER_ALLOW_EMPTY_PASSWORDS = "allowEmptyPasswords";
+
//public static final String ROLE_CONTAINER_DN = "roleContainerDN";
public static final String ROLE_RID_ATTRIBUTE_ID = "ridAttributeID";
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java 2007-11-22 08:34:22 UTC (rev 9072)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java 2007-11-22 09:24:02 UTC (rev 9073)
@@ -117,6 +117,12 @@
public boolean validatePassword(LDAPUserImpl ldapu, String password) throws IdentityException
{
+ // Depending on configuration reject authentication with empty password
+ if ((password == null || password.length() == 0) & !isAllowEmptyPasswords())
+ {
+ return false;
+ }
+
//will use user DN to bind checking the password by default
String principal = ldapu.getDn();
@@ -398,9 +404,20 @@
}
+ protected boolean isAllowEmptyPasswords()
+ {
+ String allowEmptyPasswords = getIdentityConfiguration().getValue(IdentityConfiguration.USER_ALLOW_EMPTY_PASSWORDS);
+ if (allowEmptyPasswords != null && allowEmptyPasswords.equalsIgnoreCase("true"))
+ {
+ return Boolean.TRUE.booleanValue();
+ }
+ return Boolean.FALSE.booleanValue();
+ }
+
+
/*protected String getEmailAttributeId() throws IdentityException
{
String email = getIdentityConfiguration().getValue(IdentityConfiguration.USER_EMAIL_ATTRIBUTE_ID);
16 years, 7 months
JBoss Portal SVN: r9072 - in branches/JBoss_Portal_Branch_2_6/core/src: resources/portal-core-sar/conf and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-11-22 03:34:22 -0500 (Thu, 22 Nov 2007)
New Revision: 9072
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/config.xml
Log:
JBPORTAL-1813: Switching to secured login should be enabled by configuration
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2007-11-21 23:14:11 UTC (rev 9071)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2007-11-22 08:34:22 UTC (rev 9072)
@@ -214,6 +214,11 @@
{
portalURL = new PortalURLImpl(cc, controllerCtx, Boolean.TRUE, null);
}
+ String securedLogin = config.getProperty("core.login.secured");
+ if (securedLogin != null && "true".equals(securedLogin.toLowerCase()))
+ {
+ portalURL.setSecure(Boolean.TRUE);
+ }
rd.setAttribute("org.jboss.portal.header.LOGIN_URL", portalURL);
}
Modified: branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/config.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/config.xml 2007-11-21 23:14:11 UTC (rev 9071)
+++ branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/config.xml 2007-11-22 08:34:22 UTC (rev 9072)
@@ -34,4 +34,6 @@
<entry key="core.render.window_not_found">show</entry>
<!-- Namespace to use when logging-in, use "dashboard" to directly log-in the dashboard otherwise use "default" -->
<entry key="core.login.namespace">default</entry>
+ <!-- true if the server should switch to HTTPS for logging-in. Secured layer must be properly set before -->
+ <entry key="core.login.secured">false</entry>
</properties>
16 years, 7 months
JBoss Portal SVN: r9071 - in branches/JBoss_Portal_Branch_2_6/wsrp: src/main/org/jboss/portal/test/wsrp/v1/producer and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-11-21 18:14:11 -0500 (Wed, 21 Nov 2007)
New Revision: 9071
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/build.xml
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/PortletManagementTestCase.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java
Log:
- Use proper exceptions.
- Added access to WSRP classes on the client for producer test to bypass RMI issues.
- All WSRP tests now pass pending resolution of test agent issue wrt to bundling of portal-common-lib.jar.
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/build.xml 2007-11-21 22:50:35 UTC (rev 9070)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/build.xml 2007-11-21 23:14:11 UTC (rev 9071)
@@ -720,6 +720,12 @@
<x-classpath>
<fileset dir="${build.lib.test}" includes="test-wsrp-producer-lib.jar"/>
<path refid="tests.classpath"/>
+
+ <!--
+ Add access to WSRP classes on the client side to bypass RMI issues...
+ See http://forum.springframework.org/showthread.php?t=38231 for more details.
+ -->
+ <fileset dir="${build.lib}" includes="portal-wsrp-lib.jar"/>
</x-classpath>
</execute-tests>
<antcall target="undeploy-producer-test"/>
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2007-11-21 22:50:35 UTC (rev 9070)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2007-11-21 23:14:11 UTC (rev 9071)
@@ -26,7 +26,6 @@
import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.wsrp.WSRPActionURL;
import org.jboss.portal.wsrp.WSRPConstants;
-import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPPortletURL;
import org.jboss.portal.wsrp.WSRPRenderURL;
import org.jboss.portal.wsrp.WSRPTypeFactory;
@@ -44,6 +43,7 @@
import org.jboss.portal.wsrp.core.RuntimeContext;
import org.jboss.portal.wsrp.core.SessionContext;
import org.jboss.portal.wsrp.core.StateChange;
+import org.jboss.portal.wsrp.core.UnsupportedModeFault;
import org.jboss.portal.wsrp.core.UpdateResponse;
import java.rmi.RemoteException;
@@ -84,12 +84,10 @@
markupService.getMarkup(getMarkup);
ExtendedAssert.fail();
}
- catch (RemoteException e)
+ catch (UnsupportedModeFault unsupportedModeFault)
{
- checkException(e, WSRPExceptionFactory.UNSUPPORTED_MODE);
+ // expected
}
- // reactivate check for exception once tests go through WS stack see: JBPORTAL-1712
-// catch (UnsupportedModeFault unsupportedModeFault) { }
}
public void testGetMarkupWithSessionID() throws Exception
@@ -103,12 +101,10 @@
markupService.getMarkup(getMarkup);
ExtendedAssert.fail("A sessionID should not be allowed to be passed in GetMarkup()");
}
- catch (RemoteException e)
+ catch (OperationFailedFault operationFailedFault)
{
- checkException(e, WSRPExceptionFactory.OPERATION_FAILED);
+ // expected
}
- // reactivate check for exception once tests go through WS stack see: JBPORTAL-1712
-// catch (OperationFailedFault operationFailedFault){}
}
public void testGetMarkupEditNoSession() throws Exception
@@ -271,12 +267,10 @@
markupService.performBlockingInteraction(performBlockingInteraction);
ExtendedAssert.fail("Should not be able to pass a sessionID in a PerformBlockingInteraction()");
}
- catch (RemoteException e)
+ catch (OperationFailedFault expected)
{
- checkException(e, WSRPExceptionFactory.OPERATION_FAILED);
+ // expected
}
- // reactivate check for exception once tests go through WS stack see: JBPORTAL-1712
-// catch (OperationFailedFault expected){}
}
public void testMarkupCaching() throws Exception
@@ -499,9 +493,14 @@
GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
MarkupResponse res = markupService.getMarkup(gm);
String markupString = res.getMarkupContext().getMarkupString();
- ExtendedAssert.assertEquals("<img src='wsrp_rewrite?wsrp-urlType=resource&" +
- "wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Ftest-resource-portlet%2Fgif%2Flogo.gif&" +
- "wsrp-requiresRewrite=true/wsrp_rewrite'/>", markupString);
+
+ // accept either localhost or 127.0.0.1 for the host part of the generated markup
+ String markupStart = "<img src='wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2F";
+ String markupEnd = "%3A8080%2Ftest-resource-portlet%2Fgif%2Flogo.gif&wsrp-requiresRewrite=true/wsrp_rewrite'/>";
+ String localhostMarkup = markupStart + "localhost" + markupEnd;
+ String homeIPMarkup = markupStart + "127.0.0.1" + markupEnd;
+ boolean result = localhostMarkup.equals(markupString) || homeIPMarkup.equals(markupString);
+ ExtendedAssert.assertTrue(result);
}
finally
{
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/PortletManagementTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/PortletManagementTestCase.java 2007-11-21 22:50:35 UTC (rev 9070)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/PortletManagementTestCase.java 2007-11-21 23:14:11 UTC (rev 9071)
@@ -26,7 +26,6 @@
import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPTypeFactory;
-import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.core.ClonePortlet;
import org.jboss.portal.wsrp.core.DestroyFailed;
import org.jboss.portal.wsrp.core.DestroyPortlets;
@@ -47,7 +46,6 @@
import javax.xml.soap.SOAPElement;
import java.util.Arrays;
-import java.rmi.RemoteException;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
@@ -199,15 +197,10 @@
response = portletManagementService.setPortletProperties(setPortletProperties);
ExtendedAssert.fail("Setting properties on Producer-Offered Portlet should fail...");
}
- catch (RemoteException e)
+ catch (InconsistentParametersFault expected)
{
- //expected
- checkException(e, WSRPExceptionFactory.INCONSISTENT_PARAMETERS);
+ // expected
}
- // reactivate check for exception once tests go through WS stack see: JBPORTAL-1712
- // catch (InconsistentParametersFault expected)
- {
- }
}
private Property[] checkGetPropertiesResponse(PropertyList response, Property[] expected)
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java 2007-11-21 22:50:35 UTC (rev 9070)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java 2007-11-21 23:14:11 UTC (rev 9071)
@@ -25,21 +25,19 @@
import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.wsrp.WSRPConstants;
-import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.GetMarkup;
import org.jboss.portal.wsrp.core.GetServiceDescription;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
import org.jboss.portal.wsrp.core.ModifyRegistration;
import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.PropertyDescription;
import org.jboss.portal.wsrp.core.RegistrationContext;
import org.jboss.portal.wsrp.core.RegistrationData;
-import org.jboss.portal.wsrp.core.MissingParametersFault;
import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
import javax.xml.namespace.QName;
-import java.rmi.RemoteException;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
@@ -84,16 +82,10 @@
registrationService.register(regData);
ExtendedAssert.fail("Trying to register with an invalid consumer agent String should fail.");
}
- catch (RemoteException e)
+ catch (OperationFailedFault operationFailedFault)
{
// expected
- checkException(e, WSRPExceptionFactory.OPERATION_FAILED);
}
- // reactivate check for exception once tests go through WS stack see: JBPORTAL-1712
- // catch (OperationFailedFault operationFailedFault)
- {
- // expected
- }
regData.setConsumerAgent(WSRPConstants.CONSUMER_AGENT);
@@ -118,14 +110,8 @@
markupService.getMarkup(getMarkup);
ExtendedAssert.fail("Consumer tried to access info with a de-registered context. Operations should fail.");
}
- catch (RemoteException e)
+ catch (InvalidRegistrationFault invalidRegistrationFault)
{
- //expected
- checkException(e, WSRPExceptionFactory.INVALID_REGISTRATION);
- }
- // reactivate check for exception once tests go through WS stack see: JBPORTAL-1712
- //catch (InvalidRegistrationFault invalidRegistrationFault)
- {
// expected
}
@@ -138,14 +124,8 @@
serviceDescriptionService.getServiceDescription(gs);
ExtendedAssert.fail("Required registration info has been modified: operations should fail until registration is modified.");
}
- catch (RemoteException e)
+ catch (InvalidRegistrationFault invalidRegistrationFault)
{
- //expected
- checkException(e, WSRPExceptionFactory.INVALID_REGISTRATION);
- }
- // reactivate check for exception once tests go through WS stack see: JBPORTAL-1712
- //catch (InvalidRegistrationFault invalidRegistrationFault)
- {
// expected
}
@@ -178,14 +158,8 @@
markupService.getMarkup(getMarkup);
ExtendedAssert.fail("Required registration info has been modified: operations should fail until registration is modified.");
}
- catch (RemoteException e)
+ catch (OperationFailedFault operationFailedFault)
{
- //expected
- checkException(e, WSRPExceptionFactory.INVALID_REGISTRATION);
- }
- // reactivate check for exception once tests go through WS stack see: JBPORTAL-1712
- //catch (InvalidRegistrationFault invalidRegistrationFault)
- {
// expected
// WSRP primer recommends returning OperationFailedFault and NOT InvalidRegistrationFault
// kinda weird... will be replaced by ModifyRegistrationRequiredFault in WSRP 2.0
@@ -200,14 +174,8 @@
serviceDescriptionService.getServiceDescription(gs);
ExtendedAssert.fail("Required registration info has been modified: operations should fail until registration is modified.");
}
- catch (RemoteException e)
+ catch (OperationFailedFault operationFailedFault)
{
- //expected
- checkException(e, WSRPExceptionFactory.INVALID_REGISTRATION);
- }
- // reactivate check for exception once tests go through WS stack see: JBPORTAL-1712
- //catch (InvalidRegistrationFault invalidRegistrationFault)
- {
// expected
// WSRP primer recommends returning OperationFailedFault and NOT InvalidRegistrationFault
// kinda weird... will be replaced by ModifyRegistrationRequiredFault in WSRP 2.0
@@ -258,13 +226,8 @@
registerConsumer();
ExtendedAssert.fail("Shouldn't be possible to register if no registration is required.");
}
- catch (RemoteException e)
+ catch (OperationFailedFault operationFailedFault)
{
- checkException(e, WSRPExceptionFactory.OPERATION_FAILED); // expected
- }
- // reactivate check for exception once tests go through WS stack see: JBPORTAL-1712
- //catch (OperationFailedFault operationFailedFault)
- {
// expected
}
}
@@ -278,13 +241,8 @@
registrationService.deregister(null);
ExtendedAssert.fail("Shouldn't be possible to deregister if no registration is required.");
}
- catch (RemoteException e)
+ catch (OperationFailedFault operationFailedFault)
{
- checkException(e, WSRPExceptionFactory.OPERATION_FAILED); // expected
- }
- // reactivate check for exception once tests go through WS stack see: JBPORTAL-1712
- //catch (OperationFailedFault operationFailedFault)
- {
// expected
}
}
@@ -298,13 +256,8 @@
registrationService.modifyRegistration(null);
ExtendedAssert.fail("Shouldn't be possible to modify registration if no registration is required.");
}
- catch (RemoteException e)
+ catch (OperationFailedFault operationFailedFault)
{
- checkException(e, WSRPExceptionFactory.OPERATION_FAILED); // expected
- }
- // reactivate check for exception once tests go through WS stack see: JBPORTAL-1712
- //catch (OperationFailedFault operationFailedFault)
- {
// expected
}
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java 2007-11-21 22:50:35 UTC (rev 9070)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java 2007-11-21 23:14:11 UTC (rev 9071)
@@ -25,13 +25,11 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.junit.ExtendedAssert;
-import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPTypeFactory;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.RegistrationContext;
import org.jboss.portal.wsrp.core.ReleaseSessions;
-import java.rmi.RemoteException;
-
/**
* Tests the behavior of the ReleaseSession method.
*
@@ -115,15 +113,10 @@
markupService.releaseSessions(releaseSessions);
ExtendedAssert.fail("ReleaseSessions did not thrown an OperationFailed Fault." + getSetupString(releaseSessions));
}
- catch (RemoteException e)
+ catch (OperationFailedFault operationFailedFault)
{
- checkException(e, WSRPExceptionFactory.OPERATION_FAILED);
- }
- // reactivate check for exception once tests go through WS stack see: JBPORTAL-1712
- /*catch (OperationFailedFault operationFailedFault)
- {
// expected fault.
- }*/
+ }
finally
{
tearDown();
16 years, 7 months
JBoss Portal SVN: r9070 - modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-11-21 17:50:35 -0500 (Wed, 21 Nov 2007)
New Revision: 9070
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLDAPExtLoginModule.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLDAPLoginModule.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLoginModule.java
Log:
Add more precise control on how Synchronizing Login Modules sync roles
Modified: modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLDAPExtLoginModule.java
===================================================================
--- modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLDAPExtLoginModule.java 2007-11-21 22:42:57 UTC (rev 9069)
+++ modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLDAPExtLoginModule.java 2007-11-21 22:50:35 UTC (rev 9070)
@@ -61,6 +61,7 @@
protected String roleModuleJNDIName;
protected String membershipModuleJNDIName;
protected String userProfileModuleJNDIName;
+ protected String preserveRoles;
private UserModule userModule;
@@ -82,7 +83,9 @@
synchronizeIdentity = (String)options.get("synchronizeIdentity");
synchronizeRoles = (String)options.get("synchronizeRoles");
defaultAssignedRole = (String)options.get("defaultAssignedRole");
+ preserveRoles = (String)options.get("preserveRoles");
+
// Some info
log.trace("additionalRole = " + additionalRole);
log.trace("userModuleJNDIName = " + userModuleJNDIName);
@@ -92,6 +95,8 @@
log.trace("synchronizeIdentity = " + synchronizeIdentity);
log.trace("synchronizeRoles = " + synchronizeRoles);
log.trace("defaultAssignedRole = " + defaultAssignedRole);
+ log.trace("preserveRoles = " + preserveRoles);
+
}
protected UserModule getUserModule() throws Exception
@@ -317,6 +322,15 @@
if (rolesToAssign.size() > 0)
{
+ // If we don't want to overwrite roles assignemts already present in identity store
+ if ( isPreserveRoles() || !isSynchronizeRoles())
+ {
+ Set presentRoles = getMembershipModule().getRoles(user);
+ if (presentRoles != null)
+ {
+ rolesToAssign.addAll(presentRoles);
+ }
+ }
getMembershipModule().assignRoles(user, rolesToAssign);
}
@@ -355,5 +369,14 @@
return Boolean.TRUE.booleanValue();
}
+ protected boolean isPreserveRoles()
+ {
+ if (preserveRoles != null && preserveRoles.equalsIgnoreCase("true"))
+ {
+ return Boolean.TRUE.booleanValue();
+ }
+ return Boolean.FALSE.booleanValue();
+ }
+
}
Modified: modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLDAPLoginModule.java
===================================================================
--- modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLDAPLoginModule.java 2007-11-21 22:42:57 UTC (rev 9069)
+++ modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLDAPLoginModule.java 2007-11-21 22:50:35 UTC (rev 9070)
@@ -60,6 +60,7 @@
protected String roleModuleJNDIName;
protected String membershipModuleJNDIName;
protected String userProfileModuleJNDIName;
+ protected String preserveRoles;
private UserModule userModule;
@@ -80,7 +81,9 @@
synchronizeIdentity = (String)options.get("synchronizeIdentity");
synchronizeRoles = (String)options.get("synchronizeRoles");
defaultAssignedRole = (String)options.get("defaultAssignedRole");
+ preserveRoles = (String)options.get("preserveRoles");
+
// Some info
log.trace("additionalRole = " + additionalRole);
log.trace("userModuleJNDIName = " + userModuleJNDIName);
@@ -90,6 +93,8 @@
log.trace("synchronizeIdentity = " + synchronizeIdentity);
log.trace("synchronizeRoles = " + synchronizeRoles);
log.trace("defaultAssignedRole = " + defaultAssignedRole);
+ log.trace("preserveRoles = " + preserveRoles);
+
}
protected UserModule getUserModule() throws Exception
@@ -314,6 +319,16 @@
if (rolesToAssign.size() > 0)
{
+ // If we don't want to overwrite roles assignemts already present in identity store
+ if ( isPreserveRoles() || !isSynchronizeRoles())
+ {
+ Set presentRoles = getMembershipModule().getRoles(user);
+ if (presentRoles != null)
+ {
+ rolesToAssign.addAll(presentRoles);
+ }
+ }
+
getMembershipModule().assignRoles(user, rolesToAssign);
}
@@ -352,5 +367,14 @@
return Boolean.TRUE.booleanValue();
}
+ protected boolean isPreserveRoles()
+ {
+ if (preserveRoles != null && preserveRoles.equalsIgnoreCase("true"))
+ {
+ return Boolean.TRUE.booleanValue();
+ }
+ return Boolean.FALSE.booleanValue();
+ }
+
}
Modified: modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLoginModule.java
===================================================================
--- modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLoginModule.java 2007-11-21 22:42:57 UTC (rev 9069)
+++ modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLoginModule.java 2007-11-21 22:50:35 UTC (rev 9070)
@@ -63,8 +63,10 @@
protected String roleModuleJNDIName;
protected String membershipModuleJNDIName;
protected String userProfileModuleJNDIName;
+ protected String preserveRoles;
+
private UserModule userModule;
private RoleModule roleModule;
private MembershipModule membershipModule;
@@ -83,6 +85,7 @@
synchronizeIdentity = (String)options.get("synchronizeIdentity");
synchronizeRoles = (String)options.get("synchronizeRoles");
defaultAssignedRole = (String)options.get("defaultAssignedRole");
+ preserveRoles = (String)options.get("preserveRoles");
// Some info
if (log.isTraceEnabled())
@@ -95,6 +98,7 @@
log.trace("synchronizeIdentity = " + synchronizeIdentity);
log.trace("synchronizeRoles = " + synchronizeRoles);
log.trace("defaultAssignedRole = " + defaultAssignedRole);
+ log.trace("preserveRoles = " + preserveRoles);
}
}
@@ -352,6 +356,16 @@
if (rolesToAssign.size() > 0)
{
+ // If we don't want to overwrite roles assignemts already present in identity store
+ if ( isPreserveRoles() || !isSynchronizeRoles())
+ {
+ Set presentRoles = getMembershipModule().getRoles(user);
+ if (presentRoles != null)
+ {
+ rolesToAssign.addAll(presentRoles);
+ }
+ }
+
getMembershipModule().assignRoles(user, rolesToAssign);
}
@@ -389,4 +403,13 @@
}
return Boolean.TRUE.booleanValue();
}
+
+ protected boolean isPreserveRoles()
+ {
+ if (preserveRoles != null && preserveRoles.equalsIgnoreCase("true"))
+ {
+ return Boolean.TRUE.booleanValue();
+ }
+ return Boolean.FALSE.booleanValue();
+ }
}
16 years, 7 months
JBoss Portal SVN: r9069 - modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/auth.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-11-21 17:42:57 -0500 (Wed, 21 Nov 2007)
New Revision: 9069
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLDAPExtLoginModule.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLDAPLoginModule.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLoginModule.java
Log:
Add more precise control on how Synchronizing Login Modules sync roles
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLDAPExtLoginModule.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLDAPExtLoginModule.java 2007-11-21 18:32:50 UTC (rev 9068)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLDAPExtLoginModule.java 2007-11-21 22:42:57 UTC (rev 9069)
@@ -61,6 +61,7 @@
protected String roleModuleJNDIName;
protected String membershipModuleJNDIName;
protected String userProfileModuleJNDIName;
+ protected String preserveRoles;
private UserModule userModule;
@@ -82,7 +83,9 @@
synchronizeIdentity = (String)options.get("synchronizeIdentity");
synchronizeRoles = (String)options.get("synchronizeRoles");
defaultAssignedRole = (String)options.get("defaultAssignedRole");
+ preserveRoles = (String)options.get("preserveRoles");
+
// Some info
log.trace("additionalRole = " + additionalRole);
log.trace("userModuleJNDIName = " + userModuleJNDIName);
@@ -92,6 +95,8 @@
log.trace("synchronizeIdentity = " + synchronizeIdentity);
log.trace("synchronizeRoles = " + synchronizeRoles);
log.trace("defaultAssignedRole = " + defaultAssignedRole);
+ log.trace("preserveRoles = " + preserveRoles);
+
}
protected UserModule getUserModule() throws Exception
@@ -317,6 +322,15 @@
if (rolesToAssign.size() > 0)
{
+ // If we don't want to overwrite roles assignemts already present in identity store
+ if ( isPreserveRoles() || !isSynchronizeRoles())
+ {
+ Set presentRoles = getMembershipModule().getRoles(user);
+ if (presentRoles != null)
+ {
+ rolesToAssign.addAll(presentRoles);
+ }
+ }
getMembershipModule().assignRoles(user, rolesToAssign);
}
@@ -355,5 +369,14 @@
return Boolean.TRUE.booleanValue();
}
+ protected boolean isPreserveRoles()
+ {
+ if (preserveRoles != null && preserveRoles.equalsIgnoreCase("true"))
+ {
+ return Boolean.TRUE.booleanValue();
+ }
+ return Boolean.FALSE.booleanValue();
+ }
+
}
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLDAPLoginModule.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLDAPLoginModule.java 2007-11-21 18:32:50 UTC (rev 9068)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLDAPLoginModule.java 2007-11-21 22:42:57 UTC (rev 9069)
@@ -60,6 +60,7 @@
protected String roleModuleJNDIName;
protected String membershipModuleJNDIName;
protected String userProfileModuleJNDIName;
+ protected String preserveRoles;
private UserModule userModule;
@@ -80,7 +81,9 @@
synchronizeIdentity = (String)options.get("synchronizeIdentity");
synchronizeRoles = (String)options.get("synchronizeRoles");
defaultAssignedRole = (String)options.get("defaultAssignedRole");
+ preserveRoles = (String)options.get("preserveRoles");
+
// Some info
log.trace("additionalRole = " + additionalRole);
log.trace("userModuleJNDIName = " + userModuleJNDIName);
@@ -90,6 +93,8 @@
log.trace("synchronizeIdentity = " + synchronizeIdentity);
log.trace("synchronizeRoles = " + synchronizeRoles);
log.trace("defaultAssignedRole = " + defaultAssignedRole);
+ log.trace("preserveRoles = " + preserveRoles);
+
}
protected UserModule getUserModule() throws Exception
@@ -314,6 +319,16 @@
if (rolesToAssign.size() > 0)
{
+ // If we don't want to overwrite roles assignemts already present in identity store
+ if ( isPreserveRoles() || !isSynchronizeRoles())
+ {
+ Set presentRoles = getMembershipModule().getRoles(user);
+ if (presentRoles != null)
+ {
+ rolesToAssign.addAll(presentRoles);
+ }
+ }
+
getMembershipModule().assignRoles(user, rolesToAssign);
}
@@ -352,5 +367,14 @@
return Boolean.TRUE.booleanValue();
}
+ protected boolean isPreserveRoles()
+ {
+ if (preserveRoles != null && preserveRoles.equalsIgnoreCase("true"))
+ {
+ return Boolean.TRUE.booleanValue();
+ }
+ return Boolean.FALSE.booleanValue();
+ }
+
}
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLoginModule.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLoginModule.java 2007-11-21 18:32:50 UTC (rev 9068)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/identity/src/main/org/jboss/portal/identity/auth/SynchronizingLoginModule.java 2007-11-21 22:42:57 UTC (rev 9069)
@@ -63,8 +63,10 @@
protected String roleModuleJNDIName;
protected String membershipModuleJNDIName;
protected String userProfileModuleJNDIName;
+ protected String preserveRoles;
+
private UserModule userModule;
private RoleModule roleModule;
private MembershipModule membershipModule;
@@ -83,6 +85,7 @@
synchronizeIdentity = (String)options.get("synchronizeIdentity");
synchronizeRoles = (String)options.get("synchronizeRoles");
defaultAssignedRole = (String)options.get("defaultAssignedRole");
+ preserveRoles = (String)options.get("preserveRoles");
// Some info
if (log.isTraceEnabled())
@@ -95,6 +98,7 @@
log.trace("synchronizeIdentity = " + synchronizeIdentity);
log.trace("synchronizeRoles = " + synchronizeRoles);
log.trace("defaultAssignedRole = " + defaultAssignedRole);
+ log.trace("preserveRoles = " + preserveRoles);
}
}
@@ -352,6 +356,16 @@
if (rolesToAssign.size() > 0)
{
+ // If we don't want to overwrite roles assignemts already present in identity store
+ if ( isPreserveRoles() || !isSynchronizeRoles())
+ {
+ Set presentRoles = getMembershipModule().getRoles(user);
+ if (presentRoles != null)
+ {
+ rolesToAssign.addAll(presentRoles);
+ }
+ }
+
getMembershipModule().assignRoles(user, rolesToAssign);
}
@@ -389,4 +403,13 @@
}
return Boolean.TRUE.booleanValue();
}
+
+ protected boolean isPreserveRoles()
+ {
+ if (preserveRoles != null && preserveRoles.equalsIgnoreCase("true"))
+ {
+ return Boolean.TRUE.booleanValue();
+ }
+ return Boolean.FALSE.booleanValue();
+ }
}
16 years, 7 months