Advanced Customization > Services and Infrastructure Customization > Customizing LDAP Attributes > Customizing LDAP Mapped Attributes in a User Information Page
  
Customizing LDAP Mapped Attributes in a User Information Page
1. Login as the Site Adminstrator and navigate to Site > Utilities > Info*Engine Administration
Edit the JNDI adapter which is configured for the LDAP that contains the additional attributes you want mapped to the user.
In the Additional Properties section of the JNDI adapter properties page, add the property <service.name>.windchill.mapping.user.attributes and enter the attributes (comma separated) you want mapped as values for this property. The <service.name> is the name of the adapter whose properties you are modifying. If you chose to replace windchill with either the name you provided for the web application, or any other name, then you can add the property “wt.org.webAppName” to wt.properties and provide the name you intend to use.
2. Open the LogicalAttributes.xml file from the <Windchill>\codebase directory. Search for any definition of the WTUser class name and append definitions for the attributes you created in step 1 to this section.
For example, for an attribute name “citizenship” the definition is shown below. Make sure the value in the LogicalForm tag is the same as the attribute you defined in step 1. The attributes are case-sensitive.
<Property>
<LogicalForm>citizenship</LogicalForm>
<ExternalForm>SCA|citizenship.key</ExternalForm>
</Property>
3. Add additional information on each of these attributes and the corresponding Server Calculated Attribute Function (SCAF) that needs to be invoked to retrieve the values of these attributes, into a resource bundle that is supported for customization.
For example, modify the orgModelRB.rbInfo file in the <Windchill>\src\wt\org directory and add entries similar to the following:
WCTYPE|wt.org.WTUser~SCA|citizenship.key.value=Citizenship
WCTYPE|wt.org.WTUser~SCA|citizenship.key.abbreviatedDisplay=Citizenship
WCTYPE|wt.org.WTUser~SCA|citizenship.key.dataType=java.lang.String
WCTYPE|wt.org.WTUser~SCA|citizenship.key.serverFunction=
com.ptc.core.foundation.org.server.impl.SACFLdapAttributeContainerFunction
WCTYPE|wt.org.WTUser~SCA|citizenship.key.serverFunction.arg1=
String{citizenship}
* 
The value of serverFunction should remain the same as the one provided above, unless you write your own SCAF function. In addition if the attribute was defined as a Boolean in step 1, then key.dataType should be java.lang.Boolean. Do not change the type in key.serverFunction. This must always be a String type.
4. Then run the following command in a Windchill shell to generate the corresponding .ser file in the runtime location (for example <Windchill>\codebase\wt\org).
tools bundle -Dbundle.input=<Windchill>\src\wt\org -Dbundle.recurse=true
5. Once the build is successful, check the runtime location at <Windchill>\codebase\wt\org to make sure the .ser files were created.
6. Run the following command in a Windchill shell and view the .lst file generated in the <Windchill>\temp directory to verify the entries generated correctly.
windchill wt.util.resource.ResourceBundleUtil wt.org.orgModelRB en_US
7. Run the following command from a Windchill shell to rebuild the client jars.
ant -f codebase/MakeJar.xml
8. Delete the work directory from the <Windchill>\Tomcat directory.
9. Restart Windchill.
10. Navigate to the Site > Utilities > Type and Attribute Management. and create new alias attributes for the attributes defined in step 2 for the User type.
Verify the value for Internal Name matches the name provided in the LogicalForm tag in step 2.
Select the corresponding type in the next screen depending on whether the attribute in ldap that you are mapping to, is a String or a Boolean.
On the following screen provide a display name. This can be anything. This controls what displays on the layout to which these attributes will be added.
In the Mapping field, provide the value that matches the ExternalForm tag in step 2.
11. After the attributes are created, you can add them to the Information Page layout. By default these additional attributes will also appear on the Simplified User details page. To hide these additional attributes from the Simplified User details page, there needs to be a custom Java validator written. You will find an example validator under prog_examples\principal\user\validators of your install directory. The file is called UserAttributeCompanyNameValidator.
The only thing that needs to change based on the attribute that you want hidden, is the name of the class and the return type. You will need to create a similar file in your customization directory and then execute the following command in a Windchill shell to build it.
ant -f bin/tools.xml class -Dclass.includes=*.java -Dclass.source=
<custom directory structure where the file exists>
For example:
ant -f bin/tools.xml class -Dclass.includes=*.java -Dclass.source=
<Windchill>\prog_examples\principal\user\validators
* 
One validator must be written for each attribute that should be hidden.
12. The validator information should then be included in the <!-user attribute validators -!> section of the PrincipalAdmin-service.properties.xconf file, which is located in the codebase\com\ptc\windchill\principal directory.
Propogate the changes using the xconfManager -Fp command.
Example:
<OptionserviceClass="com.ptc.windchill.principal.user.validators.
UserAttributeCompanyNameValidator
"
cardinality="duplicate" requestor="null" selector="company" />
13. Restart Windchill.