Extending User Profiles in JBoss Portal

1) Add to the jboss-portal.sar/conf/identity/profile-config.xml file:

<property>
  <name>property</name>
  <type>java.lang.String</type> <!-- Mandatory -->
  <access-mode>read-write</access-mode>
  <usage>mandatory</usage>
  <display-name xml:lang="en">Display Name</display-name>
  <description xml:lang="en">Description</description>
  <mapping>
    <database>
      <type>dynamic</type>
      <value>propertyname</value>
    </database>
  </mapping>
</property>

2) Add to the jboss-portal.sar/portal-identity.sar/conf/identity-ui-configuration.xml file:

<ui-component name="property">
  <property-ref>property</property-ref>
  <required>true</required>
</ui-component>

3) Add to the resource bundle(s):

IDENTITY_PROPERTY=Property

4) Add to the jboss-portal-sar/portal-identity.sar/portal-identity.war/jsf/common/editProfileInfo.xhtml file:

<h:panelGroup>
  <h:outputText value="#{bundle.IDENTITY_PROPERTY}"/>
  <h:outputText value=" *" rendered="#{metadataservice.property.required}" />
</h:panelGroup>
<h:inputText id="#{metadataservice.property.name}" value="#{manager.uiUser.attribute.property}" required="#{metadataservice.property.required}"/>
<h:panelGroup />
<h:message for="#{metadataservice.property.name}" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>

5) Add to the jboss-portal-sar/portal-identity.sar/portal-identity.war/jsf/common/register.xhtml file:

<h:panelGroup>
  <h:outputText value="#{bundle.IDENTITY_PROPERTY}"/>
  <h:outputText value=" *" rendered="#{metadataservice.property.required}" />
</h:panelGroup>
<h:inputText id="#{metadataservice.property.name}" value="#{manager.uiUser.attribute.property}" required="#{metadataservice.property.required}" />
<h:panelGroup />
<h:message for="#{metadataservice.property.name}" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>

6) Add to the jboss-portal-sar/portal-identity.sar/portal-identity.war/jsf/common/viewProfileInfo.xhtml file:

<h:outputText value="#{bundle.IDENTITY_PROPERTY}:" rendered="#{editprofilemgr.uiUser.attribute.property != null}"/>
<h:outputText value="#{editprofilemgr.uiUser.attribute.property}" rendered="#{editprofilemgr.uiUser.attribute.property != null}"/>
<h:outputText value="#{bundle.IDENTITY_PROPERTY}"/>
<h:outputText id="#{metadataservice.property.name}" value="#{manager.uiUser.attribute.property}"/>
<h:panelGroup />

https://jira.jboss.org/jira/browse/JBPORTAL-2383 (vote for it!)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s