Adding a custom field in the user profile

We want to add a new field for the users and show it through the user profile console.

Getting ready

It is enough to access the groovy folder inside the portal configuration in the root application folder of Gatein. Here is the complete path for the groovy folder, if you are using JBoss:

JBOSS_CONF/deploy/gatein.ear/02portal.war/groovy

Otherwise, if you are using Tomcat, you will find it at:

webapps/portal/groovy

How to do it…

  1. Locate the OrganizationPortlet that adds the profiles fields to the users.
  2. Add the following code in the first rows of the script file /groovy/ webui/form/UIVTabInputSet.gtmpl:
    if (uicomponent.findComponentById("Nameofthenewprofileblock") == null) {
            org.exoplatform.webui.form.UIFormInputSet personalInputSet = new org.exoplatform.webui.form.UIFormInputSet("Nameofthenewprofileblock ");
            def String[] fields = ["user.name.mynewfieldname"];
            uicomponent.addInput(personalInputSet, campi);
            uicomponent.addUIFormInput(personalInputSet);
          }
  3. Finally, you need to add your custom field for the localization in the resource bundle gatein.ear/exoadmin.war/WEB-INF/classes/locale/portlet/exoadmin/AccountPortlet_$$.properties:
    UIUserInfo.label.user.mynewfield=My New Field Name:

The parameter $$ will be the locale value for the related resource bundle that is selected for the user session (the default value is en).

How it works…

This file represents the page for the creation of the users. The new field will be automatically inserted and it will pass to the organization framework configured in the organization-configuration.xml. The following is the final form page returned by the framework:

How it works…

See also

  • The Integrating with Web SSO recipe
  • The Integrating with SPNEGO for Desktop SSO recipe
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.184.102