Author: emuckenhuber
Date: 2007-08-30 13:58:41 -0400 (Thu, 30 Aug 2007)
New Revision: 8110
Added:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityUserManagementService.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/impl/
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityCommandFactoryService.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityMailServiceImpl.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityUserManagementServiceImpl.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfiguration.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfigurationService.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfigurationServiceImpl.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/UIComponentConfiguration.java
trunk/core-identity/src/resources/portal-identity-sar/conf/identity-ui-configuration.xml
trunk/core-identity/src/resources/portal-identity-sar/conf/identity-ui-configuration.xsd
Removed:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactoryService.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailServiceImpl.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/IdentityManagementService.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/IdentityManagementServiceImpl.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/UIAttribute.java
Modified:
trunk/core-identity/build.xml
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityConstants.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/RegistrationService.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/CreateUserAction.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/RegistrationServiceImpl.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/SendValidationMailAction.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/UpdateEmailAction.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/ValidateEmailServiceImpl.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityRoleBean.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityUserBean.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/MetaDataServiceBean.java
trunk/core-identity/src/resources/portal-identity-sar/META-INF/jboss-service.xml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/faces-config.xml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jboss-portlet.xml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/index.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/pendingUsers.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/registerConfirm.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/searchUsers.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/confirm.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/register/confirm.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/register/overview.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/register/registerTemplate.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/startTemplate.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml
Log:
- adding xml based metadata for configuration
Modified: trunk/core-identity/build.xml
===================================================================
--- trunk/core-identity/build.xml 2007-08-30 13:49:43 UTC (rev 8109)
+++ trunk/core-identity/build.xml 2007-08-30 17:58:41 UTC (rev 8110)
@@ -88,8 +88,9 @@
&libraries;
<path id="library.classpath">
- <path refid="jboss.jbossxb.classpath"/>
- <path refid="jboss.cache.classpath"/>
+ <path refid="jboss.jbossxb.classpath"/>
+ <path refid="apache.xerces.classpath"/>
+ <path refid="jboss.cache.classpath"/>
<path refid="freemarker.freemarker.classpath"/>
<path refid="jbossas/core.libs.classpath"/>
<path refid="hibernate.hibernate.classpath"/>
@@ -212,6 +213,7 @@
<fileset dir="${el.el.lib}"
includes="el-api.jar,el-ri.jar"/>
<fileset dir="${commons.el.lib}"
includes="commons-el.jar"/>
<fileset dir="${apache.beanutils.lib}"
includes="commons-beanutils.jar"/>
+ <fileset dir="${apache.lang.lib}"
includes="commons-lang.jar"/>
<fileset dir="${apache.digester.lib}"
includes="commons-digester.jar"/>
</copy>
<copy todir="${build.resources}/portal-identity-war">
Deleted:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactoryService.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactoryService.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactoryService.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -1,104 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.identity.services;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
-import org.jboss.portal.core.identity.services.workflow.ValidateEmailService;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.PortalObjectPath;
-import
org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
-import org.jboss.portal.portlet.PortletParametersStateString;
-import org.jboss.portal.server.ServerInvocation;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public class IdentityCommandFactoryService extends AbstractCommandFactory implements
IdentityCommandFactory
-{
-
- /** . */
- protected String targetWindowRef = null;
-
- /** . */
- protected PortalObjectId targetWindowId;
-
- /** . */
- protected ValidateEmailService validateEmailService = null;
-
- public PortalObjectId getTargetWindowId()
- {
- return targetWindowId;
- }
-
- public ValidateEmailService getValidateEmailService()
- {
- return validateEmailService;
- }
-
- public void setValidateEmailService(ValidateEmailService validateEmailService)
- {
- this.validateEmailService = validateEmailService;
- }
-
- public ControllerCommand doMapping(ControllerContext controllerContext,
ServerInvocation invocation, String host,
- String contextPath, String requestPath)
- {
- PortletParametersStateString renderParameters = new
PortletParametersStateString();
-
- if (requestPath != null)
- {
-
- // Remove starting /
- String rPath = requestPath.trim().substring(1, requestPath.length());
- String[] aRequest = rPath.split("/");
- int aLength = aRequest.length;
-
- if (aLength == 2)
- {
- // TODO - UTF-8 decode
- String bpmId = aRequest[0];
- String hash = aRequest[1];
-
- validateEmailService.validateEmail(bpmId, hash);
-
- // TODO
- this.targetWindowId =
PortalObjectId.parse("default.default.CoreIdentityUserPortletWindow",
PortalObjectPath.LEGACY_FORMAT);
-
- }
- else
- {
- this.targetWindowId =
PortalObjectId.parse("default.default.CoreIdentityUserPortletWindow",
- PortalObjectPath.LEGACY_FORMAT);
- }
-
- }
- // Perform a render URL on the target window
- return new InvokePortletWindowRenderCommand(targetWindowId, Mode.VIEW,
WindowState.NORMAL, renderParameters);
- }
-
-}
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityConstants.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityConstants.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityConstants.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -29,6 +29,10 @@
public class IdentityConstants
{
public static final String HASH_SALT = "fuDrupRunEP2BRuspADr";
+
+ public static final String SUBSCRIPTION_MODE_AUTOMATIC = "automatic";
+ /** . */
+ public final static String jbp_identity_validate_email_process_name =
"jbp_identity_validate_email";
/*
* Available actions
Deleted:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailServiceImpl.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailServiceImpl.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailServiceImpl.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -1,220 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.identity.services;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.StringWriter;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-import javax.naming.InitialContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.portal.core.modules.MailModule;
-import org.jboss.portal.jems.as.JNDI;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-
-import freemarker.template.Configuration;
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public class IdentityMailServiceImpl extends AbstractJBossService implements
IdentityMailService
-{
-
- /** . */
- private Map mailData = new HashMap();
-
- /** . */
- private Locale locale;
-
- /** . */
- private String emailText = null;
-
- /** . */
- private String emailDomain = "TODO emailDomain";
-
- /** . */
- private String emailFrom = "no-reply(a)todo.com";
-
- /** . */
- private String templateLocation;
-
- /** . */
- private MailModule mailModule;
-
- /** . */
- private static final Logger log = Logger.getLogger(IdentityMailServiceImpl.class);
-
- /** . */
- private JNDI.Binding jndiBinding;
-
- /** . */
- private String jndiName = null;
-
- /** . */
- public void startService() throws Exception
- {
- super.startService();
-
- if (this.jndiName != null)
- {
- jndiBinding = new JNDI.Binding(jndiName, this);
- jndiBinding.bind();
- }
- }
-
- public void stopService() throws Exception
- {
- super.stopService();
-
- if (jndiBinding != null)
- {
- jndiBinding.unbind();
- jndiBinding = null;
- }
- }
-
- public String getEmailDomain()
- {
- return emailDomain;
- }
-
- public void setEmailDomain(String emailDomain)
- {
- this.emailDomain = emailDomain;
- }
-
- public String getEmailFrom()
- {
- return emailFrom;
- }
-
- public void setEmailFrom(String emailFrom)
- {
- this.emailFrom = emailFrom;
- }
-
- public MailModule getMailModule()
- {
- if (this.mailModule == null)
- {
- try
- {
- this.mailModule = (MailModule) new
InitialContext().lookup("java:/portal/MailModule");
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
- return mailModule;
- }
-
- public void setMailModule(MailModule mailModule)
- {
- this.mailModule = mailModule;
- }
-
- public String getJNDIName()
- {
- return this.jndiName;
- }
-
- public void setJNDIName(String jndiName)
- {
- this.jndiName = jndiName;
- }
-
- public void sendMail(String templateLocation, Map mailData, Locale locale) throws
IOException, TemplateException
- {
- this.templateLocation = templateLocation;
- this.mailData = mailData;
- this.locale = locale;
- this.mailData.put("emailDomain", emailDomain);
-
- ResourceBundle bundle = ResourceBundle.getBundle("Identity", locale);
-
- String subject = null;
- String to = (String) mailData.get("to");
-
- if (IdentityConstants.ACTION_REGISTER_USER.equals(templateLocation))
- {
- subject = bundle.getString("IDENTITY_MAIL_SUBJECT_REGISTER");
- }
- else if (IdentityConstants.ACTION_CHANGE_EMAIL.equals(templateLocation))
- {
- subject = bundle.getString("IDENTITY_MAIL_SUBJECT_CHANGE_EMAIL");
- }
- else if (IdentityConstants.ACTION_LOST_PASSWORD.equals(templateLocation))
- {
- subject = bundle.getString("IDENTITY_MAIL_SUBJECT_LOST_PASSWORD");
- }
- else
- {
- throw new IllegalArgumentException("unknown template.");
- }
-
- // Generating message
- this.generateEmailText();
-
- // Sending mail
- // this.getMailModule.send(emailFrom, to , subject, emailText);
- log.debug(subject + to + this.emailText);
- }
-
- private void generateEmailText() throws IOException, TemplateException
- {
- ClassLoader tcl = Thread.currentThread().getContextClassLoader();
- URL config = tcl.getResource("conf/templates/" + this.templateLocation +
"/emailTemplate_" + locale.getLanguage() + "_" + locale.getCountry() +
".tpl");
- if (config == null)
- {
- config = tcl.getResource("conf/templates/" + this.templateLocation +
"/emailTemplate_" + locale.getLanguage() + ".tpl");
- }
- if (config == null)
- {
- config = tcl.getResource("conf/templates/" + this.templateLocation +
"/emailTemplate.tpl");
- }
- if (config == null)
- {
- throw new FileNotFoundException("Cannot load a suitable emailTemplate.tpl
in conf/templates/"
- + this.templateLocation);
- }
- InputStream in = config.openStream();
- Template tpl = new Template("emailTemplate", new InputStreamReader(in),
new Configuration());
- StringWriter out = new StringWriter();
- tpl.process(this.mailData, out);
- out.close();
-
- this.emailText = out.toString();
- }
-}
Added:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityUserManagementService.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityUserManagementService.java
(rev 0)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityUserManagementService.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -0,0 +1,41 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.identity.services;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface IdentityUserManagementService
+{
+ boolean createUser(String username, String password, Map profileMap, List roles);
+
+ public String getCurrentEmail(String username);
+
+ public boolean updateEmail(String username, String email);
+
+}
+
Copied:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityCommandFactoryService.java
(from rev 8071,
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactoryService.java)
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityCommandFactoryService.java
(rev 0)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityCommandFactoryService.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -0,0 +1,107 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.identity.services.impl;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
+import org.jboss.portal.core.identity.services.IdentityCommandFactory;
+import org.jboss.portal.core.identity.services.workflow.ValidateEmailService;
+import org.jboss.portal.core.model.instance.command.render.RenderPortletInstanceCommand;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.PortalObjectPath;
+import
org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
+import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.server.ServerInvocation;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class IdentityCommandFactoryService extends AbstractCommandFactory implements
IdentityCommandFactory
+{
+
+ /** . */
+ protected String targetWindowRef = null;
+
+ /** . */
+ protected PortalObjectId targetWindowId;
+
+ /** . */
+ protected ValidateEmailService validateEmailService = null;
+
+ public PortalObjectId getTargetWindowId()
+ {
+ return targetWindowId;
+ }
+
+ public ValidateEmailService getValidateEmailService()
+ {
+ return validateEmailService;
+ }
+
+ public void setValidateEmailService(ValidateEmailService validateEmailService)
+ {
+ this.validateEmailService = validateEmailService;
+ }
+
+ public ControllerCommand doMapping(ControllerContext controllerContext,
ServerInvocation invocation, String host,
+ String contextPath, String requestPath)
+ {
+ PortletParametersStateString renderParameters = new
PortletParametersStateString();
+
+ if (requestPath != null)
+ {
+
+ // Remove starting /
+ String rPath = requestPath.trim().substring(1, requestPath.length());
+ String[] aRequest = rPath.split("/");
+ int aLength = aRequest.length;
+
+ if (aLength == 2)
+ {
+ String bpmId = aRequest[0];
+ String hash = aRequest[1];
+ // Validating email
+ validateEmailService.validateEmail(bpmId, hash);
+
+
+// this.targetWindowId =
PortalObjectId.parse("default.default.CoreIdentityUserPortletWindow",
PortalObjectPath.LEGACY_FORMAT);
+
+ }
+/**
+ else
+ {
+ this.targetWindowId =
PortalObjectId.parse("default.default.CoreIdentityUserPortletWindow",
+ PortalObjectPath.LEGACY_FORMAT);
+ }
+*/
+ }
+ // Perform a render URL on the target window
+ return new
RenderPortletInstanceCommand("CoreIdentityUserPortletInstance", null );
+ // InvokePortletWindowRenderCommand(targetWindowId, Mode.VIEW, WindowState.NORMAL,
renderParameters);
+ }
+
+}
Copied:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityMailServiceImpl.java
(from rev 8071,
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailServiceImpl.java)
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityMailServiceImpl.java
(rev 0)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityMailServiceImpl.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -0,0 +1,210 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.identity.services.impl;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.naming.InitialContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.core.identity.services.IdentityConstants;
+import org.jboss.portal.core.identity.services.IdentityMailService;
+import org.jboss.portal.core.modules.MailModule;
+import org.jboss.portal.jems.as.JNDI;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class IdentityMailServiceImpl extends AbstractJBossService implements
IdentityMailService
+{
+
+ /** . */
+ private Map mailData = new HashMap();
+
+ /** . */
+ private Locale locale;
+
+ /** . */
+ private String emailText = null;
+
+ /** . */
+ private String emailDomain = "TODO emailDomain";
+
+ /** . */
+ private String emailFrom = "no-reply(a)todo.com";
+
+ /** . */
+ private String templateLocation;
+
+ /** . */
+ private MailModule mailModule;
+
+ /** . */
+ private static final Logger log = Logger.getLogger(IdentityMailServiceImpl.class);
+
+ /** . */
+ private JNDI.Binding jndiBinding;
+
+ /** . */
+ private String jndiName = null;
+
+ public void startService() throws Exception
+ {
+ super.startService();
+
+ if (this.jndiName != null)
+ {
+ jndiBinding = new JNDI.Binding(jndiName, this);
+ jndiBinding.bind();
+ }
+ }
+
+ public void stopService() throws Exception
+ {
+ super.stopService();
+
+ if (jndiBinding != null)
+ {
+ jndiBinding.unbind();
+ jndiBinding = null;
+ }
+ }
+
+ public String getEmailDomain()
+ {
+ return emailDomain;
+ }
+
+ public void setEmailDomain(String emailDomain)
+ {
+ this.emailDomain = emailDomain;
+ }
+
+ public String getEmailFrom()
+ {
+ return emailFrom;
+ }
+
+ public void setEmailFrom(String emailFrom)
+ {
+ this.emailFrom = emailFrom;
+ }
+
+ public MailModule getMailModule()
+ {
+ return mailModule;
+ }
+
+ public void setMailModule(MailModule mailModule)
+ {
+ this.mailModule = mailModule;
+ }
+
+ public String getJNDIName()
+ {
+ return this.jndiName;
+ }
+
+ public void setJNDIName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
+ public void sendMail(String templateLocation, Map mailData, Locale locale) throws
IOException, TemplateException
+ {
+ this.templateLocation = templateLocation;
+ this.mailData = mailData;
+ this.locale = locale;
+ this.mailData.put("emailDomain", emailDomain);
+
+ ResourceBundle bundle = ResourceBundle.getBundle("Identity", locale);
+
+ String subject = null;
+ String to = (String) mailData.get("to");
+
+ if (IdentityConstants.ACTION_REGISTER_USER.equals(templateLocation))
+ {
+ subject = bundle.getString("IDENTITY_MAIL_SUBJECT_REGISTER");
+ }
+ else if (IdentityConstants.ACTION_CHANGE_EMAIL.equals(templateLocation))
+ {
+ subject = bundle.getString("IDENTITY_MAIL_SUBJECT_CHANGE_EMAIL");
+ }
+ else if (IdentityConstants.ACTION_LOST_PASSWORD.equals(templateLocation))
+ {
+ subject = bundle.getString("IDENTITY_MAIL_SUBJECT_LOST_PASSWORD");
+ }
+ else
+ {
+ throw new IllegalArgumentException("unknown template.");
+ }
+
+ // Generating message
+ this.generateEmailText();
+
+ // Sending mail
+ // this.getMailModule.send(emailFrom, to , subject, emailText);
+ log.debug(subject + to + this.emailText);
+ }
+
+ private void generateEmailText() throws IOException, TemplateException
+ {
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ URL config = tcl.getResource("conf/templates/" + this.templateLocation +
"/emailTemplate_" + locale.getLanguage() + "_" + locale.getCountry() +
".tpl");
+ if (config == null)
+ {
+ config = tcl.getResource("conf/templates/" + this.templateLocation +
"/emailTemplate_" + locale.getLanguage() + ".tpl");
+ }
+ if (config == null)
+ {
+ config = tcl.getResource("conf/templates/" + this.templateLocation +
"/emailTemplate.tpl");
+ }
+ if (config == null)
+ {
+ throw new FileNotFoundException("Cannot load a suitable emailTemplate.tpl
in conf/templates/"
+ + this.templateLocation);
+ }
+ InputStream in = config.openStream();
+ Template tpl = new Template("emailTemplate", new InputStreamReader(in),
new Configuration());
+ StringWriter out = new StringWriter();
+ tpl.process(this.mailData, out);
+ out.close();
+
+ this.emailText = out.toString();
+ }
+}
Added:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityUserManagementServiceImpl.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityUserManagementServiceImpl.java
(rev 0)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/impl/IdentityUserManagementServiceImpl.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -0,0 +1,271 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.identity.services.impl;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.naming.InitialContext;
+
+import org.jboss.portal.core.identity.services.IdentityUserManagementService;
+import org.jboss.portal.core.identity.services.metadata.IdentityUIConfigurationService;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.IdentityServiceController;
+import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.jems.as.JNDI;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class IdentityUserManagementServiceImpl extends AbstractJBossService implements
IdentityUserManagementService
+{
+ /** . */
+ private UserModule userModule;
+
+ /** . */
+ private RoleModule roleModule;
+
+ /** . */
+ private UserProfileModule userProfileModule;
+
+ /** . */
+ private MembershipModule membershipModule;
+
+ /** . */
+ private IdentityServiceController identityServiceController;
+
+ /** . */
+ private IdentityUIConfigurationService identityUIConfigurationService;
+
+ /** . */
+ private JNDI.Binding jndiBinding;
+
+ /** . */
+ private String jndiName = null;
+
+ public void startService() throws Exception
+ {
+ super.startService();
+
+ try
+ {
+ userModule = (UserModule)
identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
+ roleModule = (RoleModule)
identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_ROLE_MODULE);
+ userProfileModule = (UserProfileModule)
identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_USER_PROFILE_MODULE);
+ membershipModule = (MembershipModule)
identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_MEMBERSHIP_MODULE);
+ }
+ catch(IdentityException e)
+ {
+ super.stopService();
+ throw new RuntimeException(e);
+ }
+
+ if (this.jndiName != null)
+ {
+ jndiBinding = new JNDI.Binding(jndiName, this);
+ jndiBinding.bind();
+ }
+ }
+
+ public void stopService() throws Exception
+ {
+ super.stopService();
+
+ if (jndiBinding != null)
+ {
+ jndiBinding.unbind();
+ jndiBinding = null;
+ }
+ }
+
+ public String getJNDIName()
+ {
+ return this.jndiName;
+ }
+
+ public void setJNDIName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
+ public IdentityServiceController getIdentityServiceController()
+ {
+ return identityServiceController;
+ }
+
+ public void setIdentityServiceController(IdentityServiceController
identityServiceController)
+ {
+ this.identityServiceController = identityServiceController;
+ }
+
+ public UserModule getUserModule()
+ {
+ return userModule;
+ }
+
+ public void setUserModule(UserModule userModule)
+ {
+ this.userModule = userModule;
+ }
+
+ public RoleModule getRoleModule()
+ {
+ return roleModule;
+ }
+
+ public void setRoleModule(RoleModule roleModule)
+ {
+ this.roleModule = roleModule;
+ }
+
+ public UserProfileModule getUserProfileModule()
+ {
+ return userProfileModule;
+ }
+
+ public void setUserProfileModule(UserProfileModule userProfileModule)
+ {
+ this.userProfileModule = userProfileModule;
+ }
+
+ public MembershipModule getMembershipModule()
+ {
+ return membershipModule;
+ }
+
+ public void setMembershipModule(MembershipModule membershipModule)
+ {
+ this.membershipModule = membershipModule;
+ }
+
+ public IdentityUIConfigurationService getIdentityUIConfigurationService()
+ {
+ return identityUIConfigurationService;
+ }
+
+ public void setIdentityUIConfigurationService(IdentityUIConfigurationService
identityUIConfigurationService)
+ {
+ this.identityUIConfigurationService = identityUIConfigurationService;
+ }
+
+ public boolean createUser(String username, String password, Map profileMap, List
roles)
+ {
+ try
+ {
+ User user = this.getUserModule().createUser(username, password);
+ Set roleSet = this.checkRoles(roles);
+
+ // Enable the user
+ profileMap.put(User.INFO_USER_ENABLED, Boolean.TRUE);
+
+ Iterator i = profileMap.keySet().iterator();
+ while (i.hasNext())
+ {
+ String key = (String) i.next();
+ Object value = profileMap.get(key);
+ this.getUserProfileModule().setProperty(user, key, value);
+ }
+
+ this.getMembershipModule().assignRoles(user, roleSet);
+ return true;
+ }
+ catch (Exception e)
+ {
+ log.error("Error when creating user", e);
+ }
+
+ return false;
+ }
+
+ public String getCurrentEmail(String username)
+ {
+ try
+ {
+ User user = this.getUserModule().findUserByUserName(username);
+ return (String) this.getUserProfileModule().getProperty(user,
User.INFO_USER_EMAIL_REAL);
+ }
+ catch (Exception e)
+ {
+ log.error("failed to retrieve current email address", e);
+ }
+ return null;
+ }
+
+ public boolean updateEmail(String username, String email)
+ {
+ try
+ {
+ User user = this.getUserModule().findUserByUserName(username);
+ this.getUserProfileModule().setProperty(user, User.INFO_USER_EMAIL_REAL,
email);
+ return true;
+ }
+ catch (Exception e)
+ {
+ log.error("failed to update email", e);
+ }
+ return false;
+ }
+
+ private Set checkRoles(List roles) throws IllegalArgumentException, IdentityException
+ {
+ Set roleSet = new HashSet();
+ // Set default roles if required
+ if (roles == null || (roles != null && roles.size() == 0 ))
+ {
+ roles =
this.identityUIConfigurationService.getConfiguration().getDefaultRoles();
+ }
+
+ if (roles != null && roles.size() > 0)
+ { // Checking existing roles
+ Iterator i = roles.iterator();
+
+ while (i.hasNext())
+ {
+ String roleName = (String) i.next();
+ Role role = this.getRoleModule().findRoleByName(roleName);
+
+ if (role == null)
+ {
+ // Create new role ?
+ }
+ else
+ {
+ roleSet.add(role);
+ }
+ }
+ }
+ return roleSet;
+ }
+
+}
Added:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfiguration.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfiguration.java
(rev 0)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfiguration.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -0,0 +1,153 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.identity.services.metadata;
+
+import java.util.List;
+
+import org.jboss.portal.core.identity.services.IdentityConstants;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class IdentityUIConfiguration
+{
+ /** . */
+ String subscriptionMode;
+
+ /** . */
+ String adminSubscriptionMode = "automatic";
+
+ /** . */
+ boolean overwriteWorkflow = false;
+
+ /** . */
+ String emailDomain;
+
+ /** . */
+ String emailFrom;
+
+ /** . */
+ List defaultRoles;
+
+ /** . */
+ String passwordGenerationCharacters;
+
+ /** . */
+ List uiComponents;
+
+ public String getSubscriptionMode()
+ {
+ return subscriptionMode;
+ }
+
+ public void setSubscriptionMode(String subscriptionMode)
+ {
+ this.subscriptionMode = subscriptionMode;
+ }
+
+ public String getAdminSubscriptionMode()
+ {
+ return adminSubscriptionMode;
+ }
+
+ public void setAdminSubscriptionMode(String adminSubscriptionMode)
+ {
+ this.adminSubscriptionMode = adminSubscriptionMode;
+ }
+
+ public boolean isOverwriteWorkflow()
+ {
+ return overwriteWorkflow;
+ }
+
+ public void setOverwriteWorkflow(boolean overwriteWorkflow)
+ {
+ this.overwriteWorkflow = overwriteWorkflow;
+ }
+
+ public String getEmailDomain()
+ {
+ return emailDomain;
+ }
+
+ public void setEmailDomain(String emailDomain)
+ {
+ this.emailDomain = emailDomain;
+ }
+
+ public String getEmailFrom()
+ {
+ return emailFrom;
+ }
+
+ public void setEmailFrom(String emailFrom)
+ {
+ this.emailFrom = emailFrom;
+ }
+
+ public List getDefaultRoles()
+ {
+ return defaultRoles;
+ }
+
+ public void setDefaultRoles(List defaultRoles)
+ {
+ this.defaultRoles = defaultRoles;
+ }
+
+ public String getPasswordGenerationCharacters()
+ {
+ return passwordGenerationCharacters;
+ }
+
+ public void setPasswordGenerationCharacters(String passwordGenerationCharacters)
+ {
+ this.passwordGenerationCharacters = passwordGenerationCharacters;
+ }
+
+ public List getUiComponents()
+ {
+ return uiComponents;
+ }
+
+ public void setUiComponents(List uiComponents)
+ {
+ this.uiComponents = uiComponents;
+ }
+
+ public boolean enableWorkflow()
+ {
+ // If subscriptionModes != automatic == true
+ if (this.subscriptionMode.equals(IdentityConstants.SUBSCRIPTION_MODE_AUTOMATIC)
+ &&
this.adminSubscriptionMode.equals(IdentityConstants.SUBSCRIPTION_MODE_AUTOMATIC))
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+}
+
Added:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfigurationService.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfigurationService.java
(rev 0)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfigurationService.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.identity.services.metadata;
+
+import javax.naming.NamingException;
+
+import org.jboss.portal.workflow.service.WorkflowService;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface IdentityUIConfigurationService
+{
+
+ IdentityUIConfiguration getConfiguration();
+ WorkflowService getWorkflowService() throws NamingException;
+}
+
Added:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfigurationServiceImpl.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfigurationServiceImpl.java
(rev 0)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/IdentityUIConfigurationServiceImpl.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -0,0 +1,205 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.identity.services.metadata;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.core.identity.services.IdentityConstants;
+import org.jboss.portal.jems.as.JNDI;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.workflow.service.WorkflowService;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
+import org.jbpm.JbpmContext;
+import org.jbpm.graph.def.ProcessDefinition;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class IdentityUIConfigurationServiceImpl extends AbstractJBossService implements
IdentityUIConfigurationService
+{
+
+ /** . */
+ private final static String schemaLocation =
"conf/identity-ui-configuration.xsd";
+
+ /** . */
+ private final static String xmlLocation =
"conf/identity-ui-configuration.xml";
+
+ /** . */
+ private IdentityUIConfiguration configuration;
+
+ /** . */
+ private WorkflowService workflowService;
+
+ /** . */
+ private JNDI.Binding jndiBinding;
+
+ /** . */
+ private String jndiName = null;
+
+ public void startService() throws Exception
+ {
+ super.startService();
+
+ try
+ {
+ // Creating IdentityUIConfiguration
+ SchemaBinding schema = XsdBinder.bind(getURL(schemaLocation).toString());
+ schema.setIgnoreUnresolvedFieldOrClass(false);
+ Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
+ this.configuration = (IdentityUIConfiguration)
unmarshaller.unmarshal(getResource(xmlLocation), schema);
+
+ // Loading Workflow if subscriptionmodes != automatic
+ if (this.configuration.enableWorkflow())
+ {
+ String subscriptionMode = this.configuration.getSubscriptionMode();
+ String adminSubscriptionMode =
this.configuration.getAdminSubscriptionMode();
+ String emailValidationProcess =
IdentityConstants.jbp_identity_validate_email_process_name;
+ if (subscriptionMode != null && adminSubscriptionMode != null
&& emailValidationProcess != null)
+ {
+ this.createJBPMContext(subscriptionMode);
+ this.createJBPMContext(adminSubscriptionMode);
+ // automatically load email validation process
+ this.createJBPMContext(emailValidationProcess);
+ }
+ else
+ {
+ throw new RuntimeException("processName cannot be null.");
+ }
+ }
+ else
+ {
+ log.info("not starting jBPM workflow.");
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Error while starting service: ", e);
+ super.stopService();
+ }
+
+ if (this.jndiName != null)
+ {
+ jndiBinding = new JNDI.Binding(jndiName, this);
+ jndiBinding.bind();
+ }
+ }
+
+ public void stopService() throws Exception
+ {
+ super.stopService();
+
+ if (jndiBinding != null)
+ {
+ jndiBinding.unbind();
+ jndiBinding = null;
+ }
+ }
+
+ public String getJNDIName()
+ {
+ return this.jndiName;
+ }
+
+ public void setJNDIName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
+ public IdentityUIConfiguration getConfiguration()
+ {
+ return this.configuration;
+ }
+
+ public void setWorkflowService(WorkflowService workflowService)
+ {
+ this.workflowService = workflowService;
+ }
+
+ public WorkflowService getWorkflowService() throws NamingException
+ {
+ if (workflowService == null)
+ {
+ try
+ {
+ workflowService = (WorkflowService) new
InitialContext().lookup("java:/portal/Workflow");
+ }
+ catch(Exception e)
+ {
+ // OK - if not using jBPM
+ if (this.configuration.enableWorkflow())
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ return workflowService;
+ }
+
+ private void createJBPMContext(String processName) throws Exception
+ {
+ if (!IdentityConstants.SUBSCRIPTION_MODE_AUTOMATIC.equals(processName))
+ {
+ String fileName = "conf/processes/" + processName + ".xml";
+
+ JbpmContext jbpmContext =
this.getWorkflowService().getJbpmConfiguration().createJbpmContext();
+
+ ProcessDefinition processDefinition =
jbpmContext.getGraphSession().findLatestProcessDefinition(processName);
+ if (processDefinition == null)
+ {
+ processDefinition = ProcessDefinition.parseXmlResource(fileName);
+ jbpmContext.deployProcessDefinition(processDefinition);
+ }
+ else
+ {
+ if (this.configuration.isOverwriteWorkflow())
+ {
+ ProcessDefinition fromConfig =
ProcessDefinition.parseXmlResource(fileName);
+ jbpmContext.deployProcessDefinition(fromConfig);
+ }
+ }
+ // Closing JbpmContext
+ IOTools.safeClose(jbpmContext);
+ }
+ }
+
+ private InputStream getResource(String path) throws IOException
+ {
+ URL url = Thread.currentThread().getContextClassLoader().getResource(path);
+ return url.openStream();
+ }
+
+ private URL getURL(String path) throws IOException
+ {
+ return Thread.currentThread().getContextClassLoader().getResource(path);
+ }
+}
Added:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/UIComponentConfiguration.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/UIComponentConfiguration.java
(rev 0)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/metadata/UIComponentConfiguration.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -0,0 +1,186 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.identity.services.metadata;
+
+import java.util.List;
+
+import javax.naming.InitialContext;
+
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.info.PropertyInfo;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class UIComponentConfiguration
+{
+ /** . */
+ private UserProfileModule userProfileModule;
+
+ /** . */
+ private String propertyRef;
+
+ /** . */
+ String localizationBundle;
+
+ /** . */
+ private String name;
+
+ /** . */
+ private List validators;
+
+ /** . */
+ private String converter;
+
+ /** . */
+ private boolean required;
+
+ /** . */
+ private boolean readOnly;
+
+ /** . */
+ private List values;
+
+ /** . */
+ private PropertyInfo propertyInfo;
+
+ public String getPropertyRef()
+ {
+ return propertyRef;
+ }
+
+ public void setPropertyRef(String identifier) throws IdentityException
+ {
+ this.propertyInfo =
this.getUserProfileModule().getProfileInfo().getPropertyInfo(identifier);
+ if (this.propertyInfo == null )
+ {
+ throw new IdentityException("Property not found");
+ }
+ this.propertyRef = identifier;
+ // not needed any more
+ this.userProfileModule = null;
+ }
+
+ public String getLocalizationBundle()
+ {
+ return localizationBundle;
+ }
+
+ public void setLocalizationBundle(String localizationBundle)
+ {
+ this.localizationBundle = localizationBundle;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ // returns the first validator
+ public String getValidator()
+ {
+ return (String) validators.get(0);
+ }
+
+ public List getValidators()
+ {
+ return validators;
+ }
+
+ public void setValidators(List validators)
+ {
+ this.validators = validators;
+ }
+
+ public boolean isRequired()
+ {
+ // If profile-info is mandatory always return true
+ return this.propertyInfo.getUsage().equals("mandatory") ? true :
required;
+ }
+
+ public void setRequired(boolean required)
+ {
+ this.required = required;
+ }
+
+ public boolean isReadOnly()
+ {
+ // If profile-info is read-only always return true
+ return this.propertyInfo.getAccessMode().equals("read-only") ? true :
readOnly;
+ }
+
+ public void setReadOnly(boolean readOnly)
+ {
+ this.readOnly = readOnly;
+ }
+
+ public String getConverter()
+ {
+ return converter;
+ }
+
+ public void setConverter(String converter)
+ {
+ this.converter = converter;
+ }
+
+ public List getValues()
+ {
+ return values;
+ }
+
+ public void setValues(List values)
+ {
+ this.values = values;
+ }
+
+ public Class getPropertyClass() throws ClassNotFoundException
+ {
+ // Returns the Class of the Property
+ return ClassLoader.getSystemClassLoader().loadClass(this.propertyInfo.getType());
+ }
+
+ private UserProfileModule getUserProfileModule()
+ {
+ if (userProfileModule == null)
+ {
+ try
+ {
+ userProfileModule = (UserProfileModule) new
InitialContext().lookup("java:/portal/UserProfileModule");
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ return userProfileModule;
+ }
+}
+
Deleted:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/IdentityManagementService.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/IdentityManagementService.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/IdentityManagementService.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -1,41 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.identity.services.workflow;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public interface IdentityManagementService
-{
- boolean createUser(String username, String password, Map profileMap, List roles);
-
- public String getCurrentEmail(String username);
-
- public boolean updateEmail(String username, String email);
-
-}
-
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/RegistrationService.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/RegistrationService.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/RegistrationService.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -33,7 +33,7 @@
public interface RegistrationService
{
/** . */
- String registerUser(String username, String password, Map profileMap, List roles,
Locale locale);
+ String registerUser(String username, String password, Map profileMap, List roles,
Locale locale, boolean adminFlag);
/** . */
String approve(String id, boolean approve);
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/CreateUserAction.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/CreateUserAction.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/CreateUserAction.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -25,7 +25,7 @@
import javax.naming.InitialContext;
import org.jboss.logging.Logger;
-import org.jboss.portal.core.identity.services.workflow.IdentityManagementService;
+import org.jboss.portal.core.identity.services.IdentityUserManagementService;
import org.jboss.portal.core.identity.services.workflow.UserContainer;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
@@ -38,7 +38,7 @@
{
/** . */
- private IdentityManagementService identityManagementService;
+ private IdentityUserManagementService identityManagementService;
/** . */
private static Logger log = Logger.getLogger(CreateUserAction.class);
@@ -52,13 +52,13 @@
log.debug("creating User: "+ uc.getUsername() );
}
- private IdentityManagementService getIdentityManagementService()
+ private IdentityUserManagementService getIdentityManagementService()
{
if (this.identityManagementService == null)
{
try
{
- this.identityManagementService = (IdentityManagementService) new
InitialContext().lookup("java:/portal/IdentityManagementService");
+ this.identityManagementService = (IdentityUserManagementService) new
InitialContext().lookup("java:/portal/IdentityUserManagementService");
}
catch (Exception e)
{
Deleted:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/IdentityManagementServiceImpl.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/IdentityManagementServiceImpl.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/IdentityManagementServiceImpl.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -1,288 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.identity.services.workflow.impl;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.naming.InitialContext;
-
-import org.jboss.portal.core.identity.services.workflow.IdentityManagementService;
-import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.MembershipModule;
-import org.jboss.portal.identity.Role;
-import org.jboss.portal.identity.RoleModule;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.identity.UserModule;
-import org.jboss.portal.identity.UserProfileModule;
-import org.jboss.portal.jems.as.JNDI;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public class IdentityManagementServiceImpl extends AbstractJBossService implements
IdentityManagementService
-{
- /** . */
- private UserModule userModule;
-
- /** . */
- private RoleModule roleModule;
-
- /** . */
- private UserProfileModule userProfileModule;
-
- /** . */
- private MembershipModule membershipModule;
-
- /** . */
- private JNDI.Binding jndiBinding;
-
- /** . */
- private String jndiName = null;
-
- /** . */
- private InitialContext initialContext;
-
- public void startService() throws Exception
- {
- super.startService();
-
- this.initialContext = new InitialContext();
-
- if (this.jndiName != null)
- {
- jndiBinding = new JNDI.Binding(jndiName, this);
- jndiBinding.bind();
- }
- }
-
- public void stopService() throws Exception
- {
- super.stopService();
-
- if (jndiBinding != null)
- {
- jndiBinding.unbind();
- jndiBinding = null;
- }
- }
-
- public String getJNDIName()
- {
- return this.jndiName;
- }
-
- public void setJNDIName(String jndiName)
- {
- this.jndiName = jndiName;
- }
-
- public UserModule getUserModule()
- {
- if (userModule == null)
- {
- try
- {
- userModule = (UserModule)
initialContext.lookup("java:/portal/UserModule");
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
- return userModule;
- }
-
- public void setUserModule(UserModule userModule)
- {
- this.userModule = userModule;
- }
-
- public RoleModule getRoleModule()
- {
- if (roleModule == null)
- {
- try
- {
- roleModule = (RoleModule)
initialContext.lookup("java:/portal/RoleModule");
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
- return roleModule;
- }
-
- public void setRoleModule(RoleModule roleModule)
- {
- this.roleModule = roleModule;
- }
-
- public UserProfileModule getUserProfileModule()
- {
- if (userProfileModule == null)
- {
- try
- {
- userProfileModule = (UserProfileModule)
initialContext.lookup("java:/portal/UserProfileModule");
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
- return userProfileModule;
- }
-
- public void setUserProfileModule(UserProfileModule userProfileModule)
- {
- this.userProfileModule = userProfileModule;
- }
-
- public MembershipModule getMembershipModule()
- {
- if (membershipModule == null)
- {
- try
- {
- membershipModule = (MembershipModule)
initialContext.lookup("java:/portal/MembershipModule");
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
- return membershipModule;
- }
-
- public void setMembershipModule(MembershipModule membershipModule)
- {
- this.membershipModule = membershipModule;
- }
-
- public boolean createUser(String username, String password, Map profileMap, List
roles)
- {
- try
- {
- User user = this.getUserModule().createUser(username, password);
- Set roleSet = this.checkRoles(roles);
-
- // Enable the user
- profileMap.put(User.INFO_USER_ENABLED, Boolean.TRUE);
-
- Iterator i = profileMap.keySet().iterator();
- while (i.hasNext())
- {
- String key = (String) i.next();
- Object value = profileMap.get(key);
- this.getUserProfileModule().setProperty(user, key, value);
- }
-
- this.getMembershipModule().assignRoles(user, roleSet);
- return true;
- }
- catch (Exception e)
- {
- log.error("Error when creating user", e);
- }
-
- return false;
- }
-
- public String getCurrentEmail(String username)
- {
- try
- {
- User user = this.getUserModule().findUserByUserName(username);
- return (String) this.getUserProfileModule().getProperty(user,
User.INFO_USER_EMAIL_REAL);
- }
- catch (Exception e)
- {
- log.error("failed to retrieve current email address", e);
- }
- return null;
- }
-
- public boolean updateEmail(String username, String email)
- {
- try
- {
- User user = this.getUserModule().findUserByUserName(username);
- this.getUserProfileModule().setProperty(user, User.INFO_USER_EMAIL_REAL,
email);
- return true;
- }
- catch (Exception e)
- {
- log.error("failed to update email", e);
- }
- return false;
- }
-
- private Set checkRoles(List roles) throws IllegalArgumentException, IdentityException
- {
- Set roleSet = new HashSet();
- if (roles != null && roles.size() > 0)
- { // Checking existing roles
- Iterator i = roles.iterator();
-
- while (i.hasNext())
- {
- String roleName = (String) i.next();
- Role role = this.getRoleModule().findRoleByName(roleName);
-
- if (role == null)
- {
- // Create new role ?
- }
- else
- {
- roleSet.add(role);
- }
- }
- return roleSet;
- }
- else
- {
- // TODO default Role
- Role role = this.getRoleModule().findRoleByName("User");
-
- if (role != null)
- {
- roleSet.add(role);
- }
- else
- {
- throw new IllegalArgumentException();
- }
-
- return roleSet;
- }
- }
-
-}
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/RegistrationServiceImpl.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/RegistrationServiceImpl.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/RegistrationServiceImpl.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -22,19 +22,23 @@
******************************************************************************/
package org.jboss.portal.core.identity.services.workflow.impl;
-import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
import org.jboss.logging.Logger;
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.core.identity.services.IdentityConstants;
+import org.jboss.portal.core.identity.services.IdentityUserManagementService;
+import org.jboss.portal.core.identity.services.metadata.IdentityUIConfiguration;
+import org.jboss.portal.core.identity.services.metadata.IdentityUIConfigurationService;
import org.jboss.portal.core.identity.services.workflow.RegistrationService;
import org.jboss.portal.core.identity.services.workflow.UserContainer;
-import org.jboss.portal.core.identity.services.workflow.ValidateEmailService;
import org.jboss.portal.identity.User;
import org.jboss.portal.jems.as.JNDI;
import org.jboss.portal.jems.as.system.AbstractJBossService;
@@ -59,67 +63,36 @@
private WorkflowService workflowService = null;
/** . */
- private String processName = "jbp_identity_validation_approval_workflow";
-
+ private String subscriptionMode = null;
+
/** . */
- private boolean overwrite = false;
+ private String adminSubscriptionMode = null;
/** . */
- private String processFile = "conf/processes/" + processName +
".xml";
-
- /** . */
private JNDI.Binding jndiBinding;
/** . */
private String jndiName = null;
-
+
/** . */
- private ValidateEmailService validateEmailService;
+ private IdentityUIConfigurationService identityUIConfigurationService;
+
+ /** . */
+ private IdentityUserManagementService identityManagementService;
public void startService() throws Exception
{
super.startService();
-
+
+ IdentityUIConfiguration cf =
this.identityUIConfigurationService.getConfiguration();
+ this.subscriptionMode = cf.getSubscriptionMode();
+ this.adminSubscriptionMode = cf.getAdminSubscriptionMode();
+
if (this.jndiName != null)
{
jndiBinding = new JNDI.Binding(jndiName, this);
jndiBinding.bind();
}
-
- InputStream is = null;
- JbpmContext jbpmContext = null;
- try
- {
- jbpmContext = this.workflowService.getJbpmConfiguration().createJbpmContext();
-
- ProcessDefinition processDefinition =
jbpmContext.getGraphSession().findLatestProcessDefinition(
- this.processName);
- if (processDefinition == null)
- {
- processDefinition = ProcessDefinition.parseXmlResource(processFile);
- jbpmContext.deployProcessDefinition(processDefinition);
- }
- else
- {
- ProcessDefinition fromConfig =
ProcessDefinition.parseXmlResource(processFile);
- if (this.overwrite)
- {
- jbpmContext.deployProcessDefinition(fromConfig);
- }
- }
- }
- catch (Exception e)
- {
- //
- this.stopService();
- //
- throw e;
- }
- finally
- {
- IOTools.safeClose(is);
- IOTools.safeClose(jbpmContext);
- }
}
public void stopService() throws Exception
@@ -133,13 +106,15 @@
}
}
- /** @return */
- public WorkflowService getWorkflowService()
+ public WorkflowService getWorkflowService() throws NamingException
{
+ if (this.workflowService == null)
+ {
+ this.workflowService = identityUIConfigurationService.getWorkflowService();
+ }
return this.workflowService;
}
- /** @param workflowService */
public void setWorkflowService(WorkflowService workflowService)
{
this.workflowService = workflowService;
@@ -156,31 +131,76 @@
{
this.jndiName = jndiName;
}
+
+ public void setIdentityUIConfigurationService(IdentityUIConfigurationService
identityUIConfigurationService)
+ {
+ this.identityUIConfigurationService = identityUIConfigurationService;
+ }
- public ValidateEmailService getValidateEmailService()
+ public IdentityUIConfigurationService getIdentityUIConfigurationService()
{
- return validateEmailService;
+ return identityUIConfigurationService;
}
- public void setValidateEmailService(ValidateEmailService validateEmailService)
+ public IdentityUserManagementService getIdentityManagementService()
{
- this.validateEmailService = validateEmailService;
+ if (identityManagementService == null)
+ {
+ try
+ {
+ identityManagementService = (IdentityUserManagementService) new
InitialContext().lookup("java:/portal/IdentityManagementService");
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ return identityManagementService;
}
- public String registerUser(String username, String password, Map profileMap, List
roles, Locale locale)
+ public void setIdentityManagementService(IdentityUserManagementService
identityManagementService)
{
+ this.identityManagementService = identityManagementService;
+ }
+
+ public String registerUser(String username, String password, Map profileMap, List
roles, Locale locale, boolean adminFlag)
+ {
+
+ if (!this.identityUIConfigurationService.getConfiguration().enableWorkflow())
+ {
+ // create user if workflow is disabled
+ this.getIdentityManagementService().createUser(username, password, profileMap,
roles);
+ return IdentityConstants.REGISTRATION_REGISTERED;
+ }
+ else
+ {
+ // choosing between subscription-mode and admin-subcription-mode
+ UserContainer user = new UserContainer(username, password, profileMap, roles);
+ if (adminFlag)
+ {
+ this.registerUserWorkflow(user, locale, this.adminSubscriptionMode);
+ }
+ else
+ {
+ this.registerUserWorkflow(user, locale, this.subscriptionMode);
+ }
+ return IdentityConstants.REGISTRATION_PENDING;
+ }
+ }
+
+ public void registerUserWorkflow(UserContainer user, Locale locale, String
processName)
+ {
JbpmContext jbpmContext = null;
ProcessInstance processInstance = null;
- // String registrationHash = this.hashGen(); - done at send email action
boolean success = false;
+
try
{
- jbpmContext = this.workflowService.getJbpmConfiguration().createJbpmContext();
- processInstance = jbpmContext.newProcessInstance(this.processName);
+ jbpmContext =
this.getWorkflowService().getJbpmConfiguration().createJbpmContext();
+ processInstance = jbpmContext.newProcessInstance(processName);
Token token = processInstance.getRootToken();
// Setting required attributes for the workflow
- UserContainer user = new UserContainer(username, password, profileMap, roles);
processInstance.getContextInstance().setVariable(IdentityConstants.VARIABLE_USER, user);
processInstance.getContextInstance().setVariable(IdentityConstants.VARIABLE_EMAIL,
user.getProfileMap().get(User.INFO_USER_EMAIL_REAL));
@@ -194,8 +214,8 @@
catch (Exception e)
{
success = false;
- log.error("Exception in Workflow", e);
- // throw new WorkflowException(e);
+ log.error("Exception in Workflow");
+ throw new RuntimeException(e);
}
finally
{
@@ -205,16 +225,21 @@
}
IOTools.safeClose(jbpmContext);
}
- return IdentityConstants.REGISTRATION_PENDING;
}
public String approve(String id, boolean approve)
{
+ // return registered if workflow is disabled
+ if (!this.identityUIConfigurationService.getConfiguration().enableWorkflow())
+ {
+ return IdentityConstants.REGISTRATION_REGISTERED;
+ }
+
JbpmContext jbpmContext = null;
try
{
long processId = Long.valueOf(id).longValue();
- jbpmContext = this.workflowService.getJbpmConfiguration().createJbpmContext();
+ jbpmContext =
this.getWorkflowService().getJbpmConfiguration().createJbpmContext();
ProcessInstance processInstance = jbpmContext.getProcessInstance(processId);
if (processInstance != null)
@@ -247,13 +272,19 @@
public int getPendingCount()
{
int count = 0;
+ if (!this.identityUIConfigurationService.getConfiguration().enableWorkflow()
+ &&
!this.subscriptionMode.equals(IdentityConstants.SUBSCRIPTION_MODE_AUTOMATIC))
+ {
+ return count;
+ }
+
JbpmContext jbpmContext = null;
try
{
- jbpmContext = this.workflowService.getJbpmConfiguration().createJbpmContext();
+ jbpmContext =
this.getWorkflowService().getJbpmConfiguration().createJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
- ProcessDefinition processDef =
graphSession.findLatestProcessDefinition(this.processName);
+ ProcessDefinition processDef =
graphSession.findLatestProcessDefinition(this.subscriptionMode);
List processInstances = graphSession.findProcessInstances(processDef.getId());
if (processInstances != null)
@@ -280,13 +311,20 @@
public List getPendingUsers()
{
List queue = new ArrayList();
+ // If workflow is enabled && USER subscriptionMode is not automatic
+ if (!this.identityUIConfigurationService.getConfiguration().enableWorkflow()
+ &&
!this.subscriptionMode.equals(IdentityConstants.SUBSCRIPTION_MODE_AUTOMATIC))
+ {
+ return queue;
+ }
+
JbpmContext jbpmContext = null;
try
{
- jbpmContext = this.workflowService.getJbpmConfiguration().createJbpmContext();
+ jbpmContext =
this.getWorkflowService().getJbpmConfiguration().createJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
- ProcessDefinition processDef =
graphSession.findLatestProcessDefinition(this.processName);
+ ProcessDefinition processDef =
graphSession.findLatestProcessDefinition(this.subscriptionMode);
List processInstances = graphSession.findProcessInstances(processDef.getId());
if (processInstances != null)
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/SendValidationMailAction.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/SendValidationMailAction.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/SendValidationMailAction.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -33,7 +33,7 @@
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.core.identity.services.IdentityConstants;
import org.jboss.portal.core.identity.services.IdentityMailService;
-import org.jboss.portal.core.identity.services.workflow.IdentityManagementService;
+import org.jboss.portal.core.identity.services.IdentityUserManagementService;
import org.jboss.portal.core.identity.services.workflow.UserContainer;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
@@ -45,7 +45,7 @@
public class SendValidationMailAction implements ActionHandler
{
/** . */
- private IdentityManagementService identityManagementService;
+ private IdentityUserManagementService identityManagementService;
/** . */
private IdentityMailService identityMailService;
@@ -139,13 +139,13 @@
return identityMailService;
}
- private IdentityManagementService getIdentityManagementService()
+ private IdentityUserManagementService getIdentityManagementService()
{
if (identityManagementService == null)
{
try
{
- this.identityManagementService = (IdentityManagementService) new
InitialContext().lookup("java:/portal/IdentityManagementService");
+ this.identityManagementService = (IdentityUserManagementService) new
InitialContext().lookup("java:/portal/IdentityManagementService");
}
catch (Exception e)
{
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/UpdateEmailAction.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/UpdateEmailAction.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/UpdateEmailAction.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -26,7 +26,7 @@
import org.jboss.logging.Logger;
import org.jboss.portal.core.identity.services.IdentityConstants;
-import org.jboss.portal.core.identity.services.workflow.IdentityManagementService;
+import org.jboss.portal.core.identity.services.IdentityUserManagementService;
import org.jboss.portal.core.identity.services.workflow.UserContainer;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
@@ -39,7 +39,7 @@
{
/** . */
- private IdentityManagementService identityManagementService;
+ private IdentityUserManagementService identityManagementService;
/** . */
private static Logger log = Logger.getLogger(CreateUserAction.class);
@@ -52,13 +52,13 @@
this.getIdentityManagementService().updateEmail(uc.getUsername(), email);
}
- private IdentityManagementService getIdentityManagementService()
+ private IdentityUserManagementService getIdentityManagementService()
{
if (identityManagementService == null)
{
try
{
- identityManagementService = (IdentityManagementService) new
InitialContext().lookup("java:/portal/IdentityManagementService");
+ identityManagementService = (IdentityUserManagementService) new
InitialContext().lookup("java:/portal/IdentityManagementService");
}
catch (Exception e)
{
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/ValidateEmailServiceImpl.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/ValidateEmailServiceImpl.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/impl/ValidateEmailServiceImpl.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -22,12 +22,15 @@
******************************************************************************/
package org.jboss.portal.core.identity.services.workflow.impl;
-import java.io.InputStream;
import java.util.Locale;
+import javax.naming.InitialContext;
+
import org.jboss.logging.Logger;
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.core.identity.services.IdentityConstants;
+import org.jboss.portal.core.identity.services.IdentityUserManagementService;
+import org.jboss.portal.core.identity.services.metadata.IdentityUIConfigurationService;
import org.jboss.portal.core.identity.services.workflow.UserContainer;
import org.jboss.portal.core.identity.services.workflow.ValidateEmailService;
import org.jboss.portal.identity.User;
@@ -35,7 +38,6 @@
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.workflow.service.WorkflowService;
import org.jbpm.JbpmContext;
-import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
@@ -47,20 +49,20 @@
{
/** . */
private static final Logger log = Logger.getLogger(ValidateEmailService.class);
+
+ /** . */
+ private String processName =
IdentityConstants.jbp_identity_validate_email_process_name;
/** . */
private WorkflowService workflowService = null;
/** . */
- private String processName = "jbp_identity_validate_email";
-
+ private IdentityUIConfigurationService identityUIConfigurationService;
+
/** . */
- private String processFile = "conf/processes/" + processName +
".xml";
-
+ private IdentityUserManagementService identityManagementService;
+
/** . */
- private boolean overwrite = false;
-
- /** . */
private JNDI.Binding jndiBinding;
/** . */
@@ -75,42 +77,6 @@
jndiBinding = new JNDI.Binding(jndiName, this);
jndiBinding.bind();
}
-
- InputStream is = null;
- JbpmContext jbpmContext = null;
- try
- {
- jbpmContext = this.workflowService.getJbpmConfiguration().createJbpmContext();
-
- ProcessDefinition processDefinition =
jbpmContext.getGraphSession().findLatestProcessDefinition(
- this.processName);
- if (processDefinition == null)
- {
- processDefinition = ProcessDefinition.parseXmlResource(processFile);
- jbpmContext.deployProcessDefinition(processDefinition);
- }
- else
- {
- ProcessDefinition fromConfig =
ProcessDefinition.parseXmlResource(processFile);
- if (this.overwrite)
- {
- jbpmContext.deployProcessDefinition(fromConfig);
- }
- }
- }
- catch (Exception e)
- {
- //
- this.stopService();
-
- //
- throw e;
- }
- finally
- {
- IOTools.safeClose(is);
- IOTools.safeClose(jbpmContext);
- }
}
public void stopService() throws Exception
@@ -124,13 +90,22 @@
}
}
- /** @return */
public WorkflowService getWorkflowService()
{
+ if ( workflowService == null)
+ {
+ try
+ {
+ workflowService = (WorkflowService)
identityUIConfigurationService.getWorkflowService();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
return this.workflowService;
}
- /** @param workflowService */
public void setWorkflowService(WorkflowService workflowService)
{
this.workflowService = workflowService;
@@ -148,18 +123,55 @@
this.jndiName = jndiName;
}
- /*
- * Create new changeEmail request
- */
+ public IdentityUIConfigurationService getIdentityUIConfigurationService()
+ {
+ return identityUIConfigurationService;
+ }
+
+ public void setIdentityUIConfigurationService(IdentityUIConfigurationService
identityUIConfigurationService)
+ {
+ this.identityUIConfigurationService = identityUIConfigurationService;
+ }
+
+ public IdentityUserManagementService getIdentityManagementService()
+ {
+ if (identityManagementService == null)
+ {
+ try
+ {
+ identityManagementService = (IdentityUserManagementService) new
InitialContext().lookup("java:/portal/IdentityManagementService");
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ return identityManagementService;
+ }
+
public String changeEmail(User user, String email, Locale locale)
{
+ if (! this.identityUIConfigurationService.getConfiguration().enableWorkflow())
+ {
+ this.getIdentityManagementService().updateEmail(user.getUserName(), email);
+ return IdentityConstants.REGISTRATION_REGISTERED;
+ }
+ else
+ {
+ this.changeEmailWorkflow(user, email, locale);
+ return IdentityConstants.REGISTRATION_PENDING;
+ }
+ }
+
+ public void changeEmailWorkflow(User user, String email, Locale locale)
+ {
JbpmContext jbpmContext = null;
ProcessInstance processInstance = null;
// String registrationHash = this.hashGen(); - generated when sending email
boolean success = false;
try
{
- jbpmContext = this.workflowService.getJbpmConfiguration().createJbpmContext();
+ jbpmContext =
this.getWorkflowService().getJbpmConfiguration().createJbpmContext();
processInstance = jbpmContext.newProcessInstance(this.processName);
Token token = processInstance.getRootToken();
@@ -185,18 +197,21 @@
}
IOTools.safeClose(jbpmContext);
}
- // TODO
- return IdentityConstants.REGISTRATION_PENDING;
}
public boolean validateEmail(String id, String registrationHash)
{
+ boolean success = false;
+ if (!this.identityUIConfigurationService.getConfiguration().enableWorkflow())
+ {
+ return success;
+ }
+
JbpmContext jbpmContext = null;
- boolean success = false;
try
{
long processId = Long.valueOf(id).longValue();
- jbpmContext = this.workflowService.getJbpmConfiguration().createJbpmContext();
+ jbpmContext =
this.getWorkflowService().getJbpmConfiguration().createJbpmContext();
ProcessInstance processInstance = jbpmContext.getProcessInstance(processId);
if (processInstance != null)
Deleted: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/UIAttribute.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/UIAttribute.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/UIAttribute.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -1,104 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.identity.ui;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public class UIAttribute
-{
- /** . */
- private String identifier;
-
- /** . */
- private String name;
-
- /** . */
- private String validator;
-
- /** . */
- private String converter;
-
- /** . */
- private boolean required;
-
- public UIAttribute(String identifier, String name)
- {
- this.identifier = identifier;
- this.name = name;
- this.validator = null;
- this.converter = null;
- this.required = false;
- }
-
- public String getIdentifier()
- {
- return identifier;
- }
-
- public void setIdentifier(String identifier)
- {
- this.identifier = identifier;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getValidator()
- {
- return validator;
- }
-
- public void setValidator(String validator)
- {
- this.validator = validator;
- }
-
- public boolean isRequired()
- {
- return required;
- }
-
- public void setRequired(boolean required)
- {
- this.required = required;
- }
-
- public String getConverter()
- {
- return converter;
- }
-
- public void setConverter(String converter)
- {
- this.converter = converter;
- }
-}
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -30,12 +30,15 @@
import javax.faces.application.FacesMessage;
+import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
import org.jboss.logging.Logger;
import org.jboss.portal.core.identity.services.workflow.RegistrationService;
import org.jboss.portal.core.identity.ui.IdentityUIUser;
import org.jboss.portal.core.identity.ui.common.IdentityUserBean;
+import org.jboss.portal.core.identity.ui.common.MetaDataServiceBean;
import org.jboss.portal.identity.User;
/**
@@ -49,6 +52,9 @@
private List roles = new ArrayList();
/** . */
+ //private List defaultRoles = null;
+
+ /** . */
private IdentityUIUser uiUser = new IdentityUIUser();
/** . */
@@ -58,6 +64,9 @@
private IdentityUserBean identityUserBean;
/** . */
+ private MetaDataServiceBean metaDataService;
+
+ /** . */
private static final Logger log = Logger.getLogger(CreateUserAction.class);
public IdentityUIUser getUiUser()
@@ -79,6 +88,12 @@
{
this.roles = roles;
}
+
+ public void setDefaultRoles(List roles)
+ {
+ //this.defaultRoles = roles;
+ this.roles = roles;
+ }
public IdentityUserBean getIdentityUserBean()
{
@@ -100,12 +115,21 @@
this.registrationService = registrationService;
}
- public String register()
+ public MetaDataServiceBean getMetaDataService()
{
+ return metaDataService;
+ }
+
+ public void setMetaDataService(MetaDataServiceBean metaDataService)
+ {
+ this.metaDataService = metaDataService;
+ }
+
+ public String register(ActionEvent ev)
+ {
if (uiUser.getUsername() != null && uiUser.getPassword() != null)
{
- log.debug("Creating user account: " + uiUser.getUsername());
-
+ String adminSubscriptionMode = (String) ev.getComponent().getId();
try
{
Class registrationDateClass =
uiUser.getAttribute().getType("registrationdate");
@@ -131,9 +155,18 @@
Map wProfileMap =
this.identityUserBean.getProfileMap(uiUser.getAttribute().getProfileAttributes());
Locale wLocale =
FacesContext.getCurrentInstance().getViewRoot().getLocale();
- String registrationStatus = this.registrationService.registerUser(wUsername,
wPassword, wProfileMap, wRoles, wLocale);
- log.debug(registrationStatus);
+ // TODO enable admin subscription mode
+ if (adminSubscriptionMode != null &&
adminSubscriptionMode.equals("admin"))
+ {
+ String registrationStatus =
this.registrationService.registerUser(wUsername, wPassword, wProfileMap, wRoles, wLocale,
true);
+ }
+ else
+ {
+ String registrationStatus =
this.registrationService.registerUser(wUsername, wPassword, wProfileMap, wRoles, wLocale,
false);
+ }
+ // log.debug(registrationStatus);
+
}
catch (Exception e)
{
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -31,6 +31,7 @@
import javax.faces.context.FacesContext;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
+import javax.faces.model.SelectItem;
import org.jboss.logging.Logger;
import org.jboss.portal.core.identity.services.workflow.RegistrationService;
@@ -70,7 +71,7 @@
private IdentityUIUser uiUser;
/** . */
- private String searchString;
+ private String searchString = null;
/** . */
private IdentityUserBean identityUserBean;
@@ -86,7 +87,7 @@
public UserAdministrationBean()
{
- this.userList = new ListDataModel();
+ // this.userList = new ListDataModel();
}
public DataModel getUserList()
@@ -119,9 +120,9 @@
return limit;
}
- public void setLimit(int limit)
+ public void setLimit(SelectItem limit)
{
- this.limit = limit;
+ this.limit = Integer.valueOf((String) limit.getValue()).intValue();
}
public List getRoles()
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityRoleBean.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityRoleBean.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityRoleBean.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -50,9 +50,6 @@
/** . */
private MembershipModule membershipModule;
- /** . */
- private String defaultRole;
-
public RoleModule getRoleModule()
{
return roleModule;
@@ -73,16 +70,6 @@
this.membershipModule = membershipModule;
}
- public String getDefaultRole()
- {
- return defaultRole;
- }
-
- public void setDefaultRole(String defaultRole)
- {
- this.defaultRole = defaultRole;
- }
-
public void assignRoles(User user, List roles) throws IllegalArgumentException,
IdentityException
{
Set roleSet = this.checkRoles(roles);
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityUserBean.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityUserBean.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityUserBean.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -31,8 +31,8 @@
import java.util.Set;
import org.jboss.logging.Logger;
+import org.jboss.portal.core.identity.services.metadata.UIComponentConfiguration;
import org.jboss.portal.core.identity.ui.IdentityUIUser;
-import org.jboss.portal.core.identity.ui.UIAttribute;
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.NoSuchUserException;
import org.jboss.portal.identity.User;
@@ -101,10 +101,10 @@
{
String key = (String) i.next();
Object value = attributeMap.get(key);
- UIAttribute uiAttribute = (UIAttribute)
this.metaDataService.getValue(key).getObject();
- if ( uiAttribute != null)
+ UIComponentConfiguration uiComponent = (UIComponentConfiguration)
this.metaDataService.getValue(key).getObject();
+ if ( uiComponent != null)
{
- profileMap.put(uiAttribute.getIdentifier(), value);
+ profileMap.put(uiComponent.getPropertyRef(), value);
}
}
return profileMap;
@@ -163,22 +163,14 @@
public Class getPropertyType(String propertyName) throws IdentityException
{
- UIAttribute uiAttribute = (UIAttribute)
this.metaDataService.getValue(propertyName).getObject();
- String type =
userProfileModule.getProfileInfo().getPropertyInfo(uiAttribute.getIdentifier()).getType();
- try
- {
- return ClassLoader.getSystemClassLoader().loadClass(type);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
+ UIComponentConfiguration uiComponent = (UIComponentConfiguration)
this.metaDataService.getValue(propertyName).getObject();
+ return uiComponent.getClass();
}
public Object getUserProperty(String username, String propertyName) throws
IllegalArgumentException, NoSuchUserException, IdentityException
{
User user = this.findUserByUserName(username);
- UIAttribute uiAttribute = (UIAttribute)
this.metaDataService.getValue(propertyName).getObject();
- return this.userProfileModule.getProperty(user, uiAttribute.getIdentifier());
+ UIComponentConfiguration uiComponent = (UIComponentConfiguration)
this.metaDataService.getValue(propertyName).getObject();
+ return this.userProfileModule.getProperty(user, uiComponent.getPropertyRef());
}
}
Modified:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/MetaDataServiceBean.java
===================================================================
---
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/MetaDataServiceBean.java 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/MetaDataServiceBean.java 2007-08-30
17:58:41 UTC (rev 8110)
@@ -23,12 +23,18 @@
package org.jboss.portal.core.identity.ui.common;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
-import org.jboss.portal.common.p3p.P3PConstants;
-import org.jboss.portal.core.identity.ui.UIAttribute;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.core.identity.services.metadata.IdentityUIConfiguration;
+import org.jboss.portal.core.identity.services.metadata.IdentityUIConfigurationService;
+import org.jboss.portal.core.identity.services.metadata.UIComponentConfiguration;
import org.jboss.portal.faces.el.PropertyValue;
import org.jboss.portal.faces.el.dynamic.DynamicBean;
-import org.jboss.portal.identity.User;
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
@@ -37,83 +43,53 @@
public class MetaDataServiceBean implements DynamicBean
{
/** . */
- HashMap map = new HashMap();
+ HashMap map = null;
+
+ /** . */
+ private IdentityUIConfigurationService identityUIConfigurationService;
public MetaDataServiceBean()
{
-
- UIAttribute uiEmail = new
UIAttribute(P3PConstants.INFO_USER_BUSINESS_INFO_ONLINE_EMAIL, "email");
- uiEmail.setValidator("EmailValidator");
- uiEmail.setRequired(true);
-
- UIAttribute uiGivenName = new UIAttribute(P3PConstants.INFO_USER_NAME_GIVEN,
"givenname");
- UIAttribute uiFamilyName = new UIAttribute(P3PConstants.INFO_USER_NAME_FAMILY,
"familyname");
- UIAttribute uiSkype = new UIAttribute(User.INFO_USER_IM_SKYPE, "skype");
- UIAttribute uiLocation = new UIAttribute(User.INFO_USER_LOCATION,
"location");
- UIAttribute uiOccupation = new UIAttribute(User.INFO_USER_OCCUPATION,
"occupation");
- UIAttribute uiExtra = new UIAttribute(User.INFO_USER_EXTRA, "extra");
- UIAttribute uiSignature = new UIAttribute(User.INFO_USER_SIGNATURE,
"signature");
- UIAttribute uiInterests = new UIAttribute(User.INFO_USER_INTERESTS,
"interests");
- UIAttribute uiLocale = new UIAttribute(User.INFO_USER_LOCALE, "locale");
- UIAttribute uiIcq = new UIAttribute(User.INFO_USER_IM_ICQ, "icq");
- UIAttribute uiAim = new UIAttribute(User.INFO_USER_IM_AIM, "aim");
- UIAttribute uiMsmn = new UIAttribute(User.INFO_USER_IM_MSNM, "msnm");
- UIAttribute uiYim = new UIAttribute(User.INFO_USER_IM_YIM, "yim");
- UIAttribute uiXmmp = new UIAttribute(User.INFO_USER_IM_XMMP, "xmmp");
- UIAttribute uiHomepage = new UIAttribute(User.INFO_USER_HOMEPAGE,
"homepage");
- UIAttribute uiTimeZone = new UIAttribute(User.INFO_USER_TIME_ZONE_OFFSET,
"timezone");
- UIAttribute uiTheme = new UIAttribute(User.INFO_USER_THEME, "theme");
- UIAttribute uiSecurityQuestion = new UIAttribute(User.INFO_USER_SECURITY_QUESTION,
"securityquestion");
- UIAttribute uiSecurityAnswer = new UIAttribute(User.INFO_USER_SECURITY_ANSWER,
"securityanswer");
- UIAttribute uiLastLogin = new UIAttribute(User.INFO_USER_LAST_LOGIN_DATE,
"lastlogin");
- UIAttribute uiRegistrationDate = new UIAttribute(User.INFO_USER_REGISTRATION_DATE,
"registrationdate");
- UIAttribute uiEnabled = new UIAttribute(User.INFO_USER_ENABLED,
"enabled");
-
- this.addToMap(uiEmail);
-
- this.addToMap(uiGivenName);
- this.addToMap(uiFamilyName);
- this.addToMap(uiSkype);
- this.addToMap(uiLocation);
- this.addToMap(uiOccupation);
- this.addToMap(uiExtra);
- this.addToMap(uiSignature);
- this.addToMap(uiInterests);
- this.addToMap(uiLocale);
- this.addToMap(uiIcq);
- this.addToMap(uiAim);
- this.addToMap(uiMsmn);
- this.addToMap(uiYim);
- this.addToMap(uiXmmp);
- this.addToMap(uiHomepage);
- this.addToMap(uiTimeZone);
- this.addToMap(uiTheme);
- this.addToMap(uiSecurityQuestion);
- this.addToMap(uiSecurityAnswer);
- this.addToMap(uiLastLogin);
- this.addToMap(uiRegistrationDate);
- this.addToMap(uiEnabled);
+ try
+ {
+ this.identityUIConfigurationService = (IdentityUIConfigurationService) new
InitialContext().lookup("java:/portal/IdentityUIConfigurationService");
+ }
+ catch (NamingException e)
+ {
+ // FIXME
+ throw new RuntimeException(e);
+ }
+ this.createMap();
}
-
+
public Class getType(Object propertyName) throws IllegalArgumentException
{
- return UIAttribute.class;
+ return Object.class;
}
public PropertyValue getValue(Object propertyName) throws IllegalArgumentException
{
- UIAttribute uiAttribute = (UIAttribute) map.get((String) propertyName);
- return uiAttribute != null ? new PropertyValue(uiAttribute) : null;
+ UIComponentConfiguration uiComponent = (UIComponentConfiguration) map.get((String)
propertyName);
+ return uiComponent != null ? new PropertyValue(uiComponent) : null;
}
public boolean setValue(Object propertyName, Object value) throws
IllegalArgumentException
{
- return false;
+ return true;
}
-
- private void addToMap(UIAttribute uiAttribute)
+
+ private void createMap()
{
- this.map.put(uiAttribute.getName(), uiAttribute);
+ this.map = new HashMap();
+ IdentityUIConfiguration cf = identityUIConfigurationService.getConfiguration();
+ List componentList = cf.getUiComponents();
+ Iterator i = componentList.iterator();
+
+ while (i.hasNext())
+ {
+ UIComponentConfiguration uiComponent = (UIComponentConfiguration) i.next();
+ map.put(uiComponent.getName(), uiComponent);
+ }
}
}
Modified:
trunk/core-identity/src/resources/portal-identity-sar/META-INF/jboss-service.xml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-sar/META-INF/jboss-service.xml 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/resources/portal-identity-sar/META-INF/jboss-service.xml 2007-08-30
17:58:41 UTC (rev 8110)
@@ -22,79 +22,93 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<server>
+
+ <!-- CommandFactory -->
<mbean
-
code="org.jboss.portal.core.identity.services.IdentityCommandFactoryService"
+
code="org.jboss.portal.core.identity.services.impl.IdentityCommandFactoryService"
name="portal:commandFactory=IdentityUI"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<depends
optional-attribute-name="ValidateEmailService"
-
proxy-type="attribute">portal:service=ValidateEmailService,type=Workflow</depends>
+
proxy-type="attribute">portal:service=ValidateEmailService,type=IdentityUI
+ </depends>
</mbean>
-
+
<mbean
- code="org.jboss.portal.core.identity.services.IdentityMailServiceImpl"
+
code="org.jboss.portal.core.identity.services.impl.IdentityMailServiceImpl"
name="portal:service=IdentityMailService,type=Mail"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <!-- depends on MailModule -->
+ <depends optional-attribute-name="MailModule"
proxy-type="attribute">portal:service=Module,type=Mail</depends>
<attribute
name="JNDIName">java:portal/IdentityMailService</attribute>
</mbean>
- <mbean
-
code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
- name="portal:commandFactory=Delegate,path=validateEmail"
+ <mbean
+
code="org.jboss.portal.core.identity.services.metadata.IdentityUIConfigurationServiceImpl"
+ name="portal:service=IdentityUIConfigurationService,type=IdentityUI"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <attribute name="Path">/validateEmail</attribute>
- <depends
- optional-attribute-name="DelegatingFactory"
-
proxy-type="attribute">portal:commandFactory=Delegating</depends>
- <depends
- optional-attribute-name="DelegateFactory"
-
proxy-type="attribute">portal:commandFactory=IdentityUI</depends>
- </mbean>
+ <depends optional-attribute-name="WorkflowService"
proxy-type="attribute">
+ portal:service=Workflow,type=WorkflowService
+ </depends>
+ <attribute
name="JNDIName">java:portal/IdentityUIConfigurationService</attribute>
+ </mbean>
<mbean
-
code="org.jboss.portal.core.identity.services.workflow.impl.IdentityManagementServiceImpl"
- name="portal:service=IdentityManagementService,type=IdentityUI"
+
code="org.jboss.portal.core.identity.services.impl.IdentityUserManagementServiceImpl"
+ name="portal:service=IdentityUserManagementService,type=IdentityUI"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <!-- depends on UserModule, RoleModule, UserProfileModule, MemberShipModule
-->
- <attribute
name="JNDIName">java:portal/IdentityManagementService</attribute>
+ <depends optional-attribute-name="IdentityServiceController"
proxy-type="attribute">
+ portal:service=Module,type=IdentityServiceController
+ </depends>
+ <attribute
name="JNDIName">java:portal/IdentityUserManagementService</attribute>
</mbean>
<mbean
code="org.jboss.portal.core.identity.services.workflow.impl.RegistrationServiceImpl"
- name="portal:service=RegistrationService,type=Workflow"
+ name="portal:service=RegistrationService,type=IdentityUI"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends optional-attribute-name="WorkflowService"
proxy-type="attribute">
- portal:service=Workflow,type=WorkflowService
+ <depends optional-attribute-name="IdentityUIConfigurationService"
proxy-type="attribute">
+ portal:service=IdentityUIConfigurationService,type=IdentityUI
</depends>
- <depends optional-attribute-name="ValidateEmailService"
proxy-type="attribute">
- portal:service=ValidateEmailService,type=Workflow
- </depends>
<attribute
name="JNDIName">java:portal/RegistrationService</attribute>
</mbean>
<mbean
code="org.jboss.portal.core.identity.services.workflow.impl.ValidateEmailServiceImpl"
- name="portal:service=ValidateEmailService,type=Workflow"
+ name="portal:service=ValidateEmailService,type=IdentityUI"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends optional-attribute-name="WorkflowService"
proxy-type="attribute">
- portal:service=Workflow,type=WorkflowService
+ <depends optional-attribute-name="IdentityUIConfigurationService"
proxy-type="attribute">
+ portal:service=IdentityUIConfigurationService,type=IdentityUI
</depends>
<attribute
name="JNDIName">java:portal/ValidateEmailService</attribute>
</mbean>
+ <mbean
+
code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
+ name="portal:commandFactory=Delegate,path=validateEmail"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="Path">/validateEmail</attribute>
+ <depends
+ optional-attribute-name="DelegatingFactory"
+
proxy-type="attribute">portal:commandFactory=Delegating</depends>
+ <depends
+ optional-attribute-name="DelegateFactory"
+
proxy-type="attribute">portal:commandFactory=IdentityUI</depends>
+ </mbean>
+
<!--
<mbean
code="org.jboss.portal.core.identity.services.IdentityURLFactory"
Added:
trunk/core-identity/src/resources/portal-identity-sar/conf/identity-ui-configuration.xml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-sar/conf/identity-ui-configuration.xml
(rev 0)
+++
trunk/core-identity/src/resources/portal-identity-sar/conf/identity-ui-configuration.xml 2007-08-30
17:58:41 UTC (rev 8110)
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<identity-ui-configuration>
+
+ <subscription-mode>jbp_identity_validation_approval_workflow</subscription-mode>
+ <overwrite-workflow>false</overwrite-workflow>
+ <email-domain>jboss.org</email-domain>
+ <email-from>no-reply(a)jboss.com</email-from>
+ <password-generation-characters>0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWyYzZ*#!+-/"</password-generation-characters>
+ <default-roles>
+ <role>User</role>
+ <role>Admin</role>
+ </default-roles>
+
+ <!-- user interface components -->
+ <ui-components>
+ <ui-component name="nickname">
+ <property-ref>user.name.nickName</property-ref>
+ <required>true</required>
+
+ </ui-component>
+ <ui-component name="givenname">
+ <property-ref>user.name.given</property-ref>
+ <required>true</required>
+ </ui-component>
+ <ui-component name="familyname">
+ <property-ref>user.name.family</property-ref>
+ <required>true</required>
+ </ui-component>
+ <ui-component name="location">
+ <property-ref>portal.user.location</property-ref>
+ <required>false</required>
+ </ui-component>
+ <ui-component name="occupation">
+ <property-ref>portal.user.occupation</property-ref>
+ <required>false</required>
+ </ui-component>
+ <ui-component name="extra">
+ <property-ref>portal.user.extra</property-ref>
+ <required>false</required>
+ </ui-component>
+ <ui-component name="signature">
+ <property-ref>portal.user.signature</property-ref>
+ <required>false</required>
+ </ui-component>
+ <ui-component name="interests">
+ <property-ref>portal.user.interests</property-ref>
+ <required>false</required>
+ </ui-component>
+ <ui-component name="icq">
+ <property-ref>portal.user.im.icq</property-ref>
+ <required>false</required>
+ </ui-component>
+ <ui-component name="aim">
+ <property-ref>portal.user.im.aim</property-ref>
+ <required>false</required>
+ </ui-component>
+ <ui-component name="msnm">
+ <property-ref>portal.user.im.msnm</property-ref>
+ <required>false</required>
+ </ui-component>
+
+ <ui-component name="yim">
+ <property-ref>portal.user.im.yim</property-ref>
+ <required>false</required>
+ </ui-component>
+ <ui-component name="skype">
+ <property-ref>portal.user.im.skype</property-ref>
+ <required>false</required>
+ </ui-component>
+ <ui-component name="xmmp">
+ <property-ref>portal.user.im.xmmp</property-ref>
+ <required>false</required>
+ </ui-component>
+ <ui-component name="homepage">
+ <property-ref>portal.user.homepage</property-ref>
+ <required>false</required>
+ </ui-component>
+ <ui-component name="timezone">
+ <property-ref>portal.user.time-zone-offset</property-ref>
+ <required>false</required>
+ </ui-component>
+ <ui-component name="theme">
+ <property-ref>portal.user.theme</property-ref>
+ <required>false</required>
+ </ui-component>
+ <ui-component name="securityquestion">
+ <property-ref>portal.user.security.question</property-ref>
+ <required>false</required>
+ </ui-component>
+ <ui-component name="securityanswer">
+ <property-ref>portal.user.security.answer</property-ref>
+ <required>false</required>
+ </ui-component>
+
+ <!-- read only :) -->
+ <ui-component name="email">
+ <property-ref>user.business-info.online.email</property-ref>
+ <validators>
+ <validator>EmailValidator</validator>
+ </validators>
+ <required>true</required>
+ </ui-component>
+ <ui-component name="locale">
+ <property-ref>portal.user.locale</property-ref>
+ <required>false</required>
+ </ui-component>
+ <ui-component name="registrationdate">
+ <property-ref>portal.user.registration-date</property-ref>
+ <required>true</required>
+ </ui-component>
+ <ui-component name="enabled">
+ <property-ref>portal.user.enabled</property-ref>
+ <required>true</required>
+ </ui-component>
+ <ui-component name="lastlogin">
+ <property-ref>portal.user.last-login-date</property-ref>
+ <required>false</required>
+ </ui-component>
+ </ui-components>
+</identity-ui-configuration>
\ No newline at end of file
Added:
trunk/core-identity/src/resources/portal-identity-sar/conf/identity-ui-configuration.xsd
===================================================================
---
trunk/core-identity/src/resources/portal-identity-sar/conf/identity-ui-configuration.xsd
(rev 0)
+++
trunk/core-identity/src/resources/portal-identity-sar/conf/identity-ui-configuration.xsd 2007-08-30
17:58:41 UTC (rev 8110)
@@ -0,0 +1,109 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+
xmlns:jbxb="http://www.jboss.org/xml/ns/jbxb"
+ elementFormDefault="qualified">
+
+<xsd:element name="identity-ui-configuration">
+ <xsd:complexType>
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class
impl="org.jboss.portal.core.identity.services.metadata.IdentityUIConfiguration"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+
+ <xsd:choice>
+ <!-- User portlet and user management portlet preferences -->
+ <xsd:element name="subscription-mode" type="subscriptionMode"
default="jbp_identity_validation_workflow"/>
+ <xsd:element name="admin-subscription-mode"
type="subscriptionMode" default="automatic"/>
+ <xsd:element name="overwrite-workflow" type="xsd:boolean"
default="false"/>
+ <xsd:element name="email-domain" minOccurs="1"
maxOccurs="1" type="xsd:string" />
+ <xsd:element name="email-from" minOccurs="1"
maxOccurs="1" type="xsd:string" />
+ <xsd:element name="password-generation-characters"
minOccurs="1" maxOccurs="1" type="xsd:string"/>
+ <xsd:element name="default-roles" type="defaultRoles"
minOccurs="1" maxOccurs="1"/>
+
+
+ <!-- user interface components -->
+ <xsd:element name="ui-components">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class impl="java.util.ArrayList"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+
+ <xsd:element name="ui-component" minOccurs="1"
maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class
impl="org.jboss.portal.core.identity.services.metadata.UIComponentConfiguration"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+ <xsd:choice>
+ <xsd:element name="property-ref" maxOccurs="1"
minOccurs="1" type="xsd:string" />
+
+ <xsd:element name="localization-bundle" type="xsd:string"
minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="validators" type="validators" />
+ <xsd:element name="converter" type="xsd:string" />
+ <xsd:element name="required" type="xsd:boolean"
default="false"/>
+ <xsd:element name="read-only" type="xsd:boolean"
default="false" />
+ </xsd:choice>
+ <!-- attribute name -->
+ <xsd:attribute name="name" type="xsd:string"
use="required" />
+ </xsd:complexType>
+
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <!-- end: user interface components -->
+ </xsd:choice>
+ </xsd:complexType>
+</xsd:element>
+
+<!-- restictions for subscription-modes -->
+
+<xsd:simpleType name="subscriptionMode">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="automatic" />
+ <xsd:enumeration value="jbp_identity_validation_workflow" />
+ <xsd:enumeration value="jbp_identity_validation_approval_workflow" />
+ </xsd:restriction>
+</xsd:simpleType>
+
+<xsd:complexType name="defaultRoles">
+ <xsd:sequence>
+ <xsd:element name="role" minOccurs="1"
type="xsd:string" maxOccurs="unbounded"/>
+ </xsd:sequence>
+</xsd:complexType>
+
+<xsd:complexType name="validators">
+ <xsd:sequence>
+ <xsd:element name="validator" minOccurs="1"
type="xsd:string" maxOccurs="unbounded"/>
+ </xsd:sequence>
+</xsd:complexType>
+
+</xsd:schema>
Modified: trunk/core-identity/src/resources/portal-identity-war/WEB-INF/faces-config.xml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/faces-config.xml 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/faces-config.xml 2007-08-30
17:58:41 UTC (rev 8110)
@@ -30,7 +30,6 @@
<application>
<variable-resolver>org.jboss.portal.core.identity.ui.faces.PortletVariableResolver</variable-resolver>
<property-resolver>org.jboss.portal.core.identity.ui.faces.PortletDelegatingPropertyResolver</property-resolver>
-<!--
<property-resolver>org.jboss.portal.faces.el.DelegatingPropertyResolver</property-resolver>
-->
<view-handler>com.sun.facelets.FaceletPortletViewHandler</view-handler>
</application>
@@ -43,15 +42,7 @@
<managed-bean-name>identityrolemgr</managed-bean-name>
<managed-bean-class>org.jboss.portal.core.identity.ui.common.IdentityRoleBean</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
- <!--
- defaultRole
- -->
<managed-property>
- <property-name>defaultRole</property-name>
- <value>User</value>
- </managed-property>
- <!-- -->
- <managed-property>
<property-name>roleModule</property-name>
<value>#{applicationScope.RoleModule}</value>
</managed-property>
@@ -100,6 +91,10 @@
<value>#{identityusermgr}</value>
</managed-property>
<managed-property>
+ <property-name>defaultRoles</property-name>
+
<value>#{applicationScope.IdentityUIConfigurationService.configuration.defaultRoles}</value>
+ </managed-property>
+ <managed-property>
<property-name>registrationService</property-name>
<value>#{applicationScope.RegistrationService}</value>
</managed-property>
@@ -156,14 +151,10 @@
<managed-bean-name>lostpasswordmgr</managed-bean-name>
<managed-bean-class>org.jboss.portal.core.identity.ui.actions.LostPasswordAction</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
- <!--
- Characters used in the generated password
- -->
<managed-property>
- <property-name>passwordCharacters</property-name>
-
<value>0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWyYzZ*#!+-/"</value>
+ <property-name>passwordCharacters</property-name>
+
<value>#{applicationScope.IdentityUIConfigurationService.configuration.passwordGenerationCharacters}</value>
</managed-property>
- <!-- -->
<managed-property>
<property-name>identityUserBean</property-name>
<value>#{identityusermgr}</value>
@@ -361,6 +352,10 @@
<from-outcome>revise</from-outcome>
<to-view-id>/WEB-INF/jsf/admin/register.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>success</from-outcome>
+ <to-view-id>/WEB-INF/jsf/admin/index.xhtml</to-view-id>
+ </navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/WEB-INF/jsf/admin/roles.xhtml</from-view-id>
Modified: trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jboss-portlet.xml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jboss-portlet.xml 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jboss-portlet.xml 2007-08-30
17:58:41 UTC (rev 8110)
@@ -73,6 +73,11 @@
<service-ref>:service=Module,type=Membership</service-ref>
</service>
<service>
+ <service-name>IdentityUIConfigurationService</service-name>
+
<service-class>org.jboss.portal.core.identity.services.metadata.IdentityUIConfigurationService</service-class>
+
<service-ref>:service=IdentityUIConfigurationService,type=IdentityUI</service-ref>
+ </service>
+ <service>
<service-name>IdentityMailService</service-name>
<service-class>org.jboss.portal.core.identity.services.IdentityMailService</service-class>
<service-ref>:service=IdentityMailService,type=Mail</service-ref>
@@ -80,11 +85,11 @@
<service>
<service-name>RegistrationService</service-name>
<service-class>org.jboss.portal.core.identity.services.workflow.RegistrationService</service-class>
- <service-ref>:service=RegistrationService,type=Workflow</service-ref>
+
<service-ref>:service=RegistrationService,type=IdentityUI</service-ref>
</service>
<service>
<service-name>ValidateEmailService</service-name>
<service-class>org.jboss.portal.core.identity.services.workflow.ValidateEmailService</service-class>
- <service-ref>:service=ValidateEmailService,type=Workflow</service-ref>
+
<service-ref>:service=ValidateEmailService,type=IdentityUI</service-ref>
</service>
</portlet-app>
\ No newline at end of file
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/index.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/index.xhtml 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/index.xhtml 2007-08-30
17:58:41 UTC (rev 8110)
@@ -10,11 +10,13 @@
<ui:define name="title"/>
<ui:define name="content">
+ <h:form>
<ul>
<li><h:commandLink value="#{bundle.IDENTITY_MANAGEMENT_SEARCH_USER}"
action="searchUsers"/></li>
<li><h:commandLink value="Show pending registrations"
action="showPendingUsers"/></li>
<li><h:commandLink value="#{bundle.IDENTITY_MANAGEMENT_CREATE_USER}"
action="createUser"/></li>
</ul>
+ </h:form>
<hr/>
<h:panelGrid columns="2">
<h:outputText value="Registered Users"/>
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles.xhtml 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles.xhtml 2007-08-30
17:58:41 UTC (rev 8110)
@@ -44,7 +44,9 @@
</h:dataTable>
</h:form>
- <p style="text-align: right"><h:commandLink value="Create new
role" action="createRole"/></p>
+ <h:form>
+ <p style="text-align: right"><h:commandLink value="Create new
role" action="createRole"/></p>
+ </h:form>
</ui:define>
</ui:composition>
</div>
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/pendingUsers.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/pendingUsers.xhtml 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/pendingUsers.xhtml 2007-08-30
17:58:41 UTC (rev 8110)
@@ -10,6 +10,7 @@
<ui:define name="title">Pending registrations</ui:define>
<ui:define name="content">
+<h:form>
<h:dataTable value="#{useradministrationbean.pendingUsers}"
var="user" rowClasses="portlet-section-body,portlet-section-alternate"
headerClass="portlet-section-header" width="100%">
<h:column>
<f:facet name="header">
@@ -54,7 +55,7 @@
</h:commandLink>
</h:column>
</h:dataTable>
-
+</h:form>
</ui:define>
</ui:composition>
</div>
\ No newline at end of file
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/registerConfirm.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/registerConfirm.xhtml 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/registerConfirm.xhtml 2007-08-30
17:58:41 UTC (rev 8110)
@@ -14,6 +14,7 @@
<ui:decorate template="/WEB-INF/jsf/common/confirm.xhtml">
<ui:param name="manager" value="#{userregistermgr}"/>
<ui:param name="show_roles" value="true"/>
+ <ui:param name="subscriptionMode" value="admin" />
</ui:decorate>
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/searchUsers.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/searchUsers.xhtml 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/searchUsers.xhtml 2007-08-30
17:58:41 UTC (rev 8110)
@@ -13,19 +13,20 @@
</ui:define>
<ui:define name="content">
<h:form>
- <h:panelGrid columns="3">
+ <h:panelGrid columns="4">
<h:inputText id="searchString"
value="#{useradministrationbean.searchString}" />
- <h:commandButton value="Search"
action="#{useradministrationbean.searchUsers}"
styleClass="portlet-form-button"/>
+ <h:commandButton id ="search"
value="#{bundle.IDENTITY_MANAGEMENT_SEARCH_USER}"
action="#{useradministrationbean.searchUsers}"
styleClass="portlet-form-button"/>
<h:selectOneMenu id="limit"
value="#{useradministrationbean.limit}">
- <f:selectItem id="limit1" itemValue="10"/>
- <f:selectItem id="limit2" itemValue="20"/>
- <f:selectItem id="limit5" itemValue="50"/>
- <f:selectItem id="limit10" itemValue="100"/>
+ <f:selectItem id="limit1" itemValue="10" />
+ <f:selectItem id="limit2" itemValue="20" />
+ <f:selectItem id="limit5" itemValue="50" />
+ <f:selectItem id="limit10" itemValue="100" />
</h:selectOneMenu>
+ <h:message for="limit" />
</h:panelGrid>
</h:form>
<hr/>
-
+ <h:form>
<h:dataTable id="userlist"
value="#{useradministrationbean.userList}" var="uiUser"
rendered="#{useradministrationbean.userList.rowCount > 0}"
rows="#{useradministrationbean.limit}"
rowClasses="portlet-section-body,portlet-section-alternate"
headerClass="portlet-section-header" width="100%">
<h:column>
<f:facet name="header">
@@ -74,10 +75,10 @@
</h:commandLink>
</h:column>
</h:dataTable>
-
-
+
<h:commandLink value=" < "
action="#{useradministrationbean.prevPage}"
rendered="#{useradministrationbean.page > 1}"
styleClass="portlet-form-button"/>
<h:commandLink value=" > "
action="#{useradministrationbean.nextPage}"
rendered="#{useradministrationbean.userList.rowCount >
useradministrationbean.limit}" styleClass="portlet-form-button"/>
+ </h:form>
<br/>
</ui:define>
</ui:composition>
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/confirm.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/confirm.xhtml 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/confirm.xhtml 2007-08-30
17:58:41 UTC (rev 8110)
@@ -28,7 +28,7 @@
<h:messages />
<hr/>
<h:commandButton value="#{bundle.IDENTITY_BUTTON_EDIT}"
action="revise" styleClass="portlet-form-button"/>
- <h:commandButton value="#{bundle.IDENTITY_BUTTON_SUBMIT}"
action="#{manager.register}" styleClass="portlet-form-button"/>
+ <h:commandButton id="#{subscriptionMode}"
value="#{bundle.IDENTITY_BUTTON_SUBMIT}"
actionListener="#{manager.register}"
styleClass="portlet-form-button"/>
</h:form>
</div>
\ No newline at end of file
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/register/confirm.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/register/confirm.xhtml 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/register/confirm.xhtml 2007-08-30
17:58:41 UTC (rev 8110)
@@ -12,6 +12,7 @@
<ui:define name="content">
<ui:decorate template="/WEB-INF/jsf/common/confirm.xhtml">
<ui:param name="manager" value="#{userregistermgr}"/>
+ <ui:param name="subscriptionMode" value="user" />
</ui:decorate>
</ui:define>
</ui:composition>
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/register/overview.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/register/overview.xhtml 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/register/overview.xhtml 2007-08-30
17:58:41 UTC (rev 8110)
@@ -12,7 +12,9 @@
#{bundle.IDENTITY_NOT_LOGGED_IN}
</ui:define>
<ui:define name="content">
+ <h:form>
<p><h:commandLink value="#{bundle.IDENTITY_CREATE_ACCOUNT}"
action="register"/></p>
+ </h:form>
</ui:define>
</ui:composition>
</div>
\ No newline at end of file
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/register/registerTemplate.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/register/registerTemplate.xhtml 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/register/registerTemplate.xhtml 2007-08-30
17:58:41 UTC (rev 8110)
@@ -16,9 +16,12 @@
<li id="currentTab">
<h:outputText value="#{bundle.IDENTITY_REGISTER}"/>
</li>
+ <!-- check if we should enable lostPassword -->
+ <c:if test="#{portletPreferenceValue.lostPassword == true}">
<li>
<h:commandLink value="#{bundle.IDENTITY_LOST_PASSWORD}"
action="lostPassword"/>
</li>
+ </c:if>
</ul>
</h:form>
Modified:
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/startTemplate.xhtml
===================================================================
---
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/startTemplate.xhtml 2007-08-30
13:49:43 UTC (rev 8109)
+++
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/startTemplate.xhtml 2007-08-30
17:58:41 UTC (rev 8110)
@@ -16,9 +16,12 @@
<li>
<h:commandLink value="#{bundle.IDENTITY_REGISTER}"
action="register"/>
</li>
+ <!-- check if we should enable lostPassword -->
+ <c:if test="#{portletPreferenceValue.lostPassword == true}">
<li>
<h:commandLink value="#{bundle.IDENTITY_LOST_PASSWORD}"
action="lostPassword"/>
</li>
+ </c:if>
</ul>
</h:form>
Modified: trunk/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml 2007-08-30
13:49:43 UTC (rev 8109)
+++ trunk/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml 2007-08-30
17:58:41 UTC (rev 8110)
@@ -37,15 +37,6 @@
<name>default-view</name>
<value>/WEB-INF/jsf/index.xhtml</value>
</init-param>
- <init-param>
- <description>Default role of registered users</description>
- <name>defaultRole</name>
- <value>User</value>
- </init-param>
- <init-param>
- <name>subscriptionMode</name>
- <value>test</value>
- </init-param>
<expiration-cache>-1</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
@@ -63,6 +54,14 @@
<preference>
<!-- Use captcha verification -->
<name>captcha</name>
+ <value>true</value>
+ </preference>
+ <preference>
+ <!--
+ Use lost password service
+ requires correct mail service configuration
+ -->
+ <name>lostPassword</name>
<value>false</value>
</preference>
</portlet-preferences>
@@ -77,15 +76,6 @@
<name>default-view</name>
<value>/WEB-INF/jsf/admin/index.xhtml</value>
</init-param>
- <init-param>
- <description>Default role of registered users</description>
- <name>defaultRole</name>
- <value>User</value>
- </init-param>
- <init-param>
- <name>subscriptionMode</name>
- <value>test</value>
- </init-param>
<expiration-cache>-1</expiration-cache>
<supports>
<mime-type>text/html</mime-type>