Modifying a person attribute mapping
In this exercise you'll make a configuration change to uPortal to add an additional mapping for the email user attribute.
If you had a database or LDAP directory you wanted to query for user attributes, or if you wanted to integrate with Shibboleth to receive user attributes through the login process, you'd also be editing the file edited in this exercise, to add a whole new attribute source rather than just to tweak an existing one.
This exercise is also an introduction to the developer tools included in uPortal for lightweight inspection of user attributes.
Step 1: Log in as admin and notice the default admin user attributes
Log in as the user "admin", which by default has password "admin". (Conveniently, even if you've completed the exercise to change the CAS configuration, admin's password will still be "admin").
Once you've logged in as admin, click on the tab named "Development". At the upper left of that tab will be a portlet named "Person Attributes". This portlet reports on the person attributes of the logged in user, and so is useful for troubleshooting what user attributes and values the portal believes the logged in user to possess. (User attributes can be used for determining PAGS groups memberships, determining membership in the audience of a DLM managed fragment (that is, what tabs users see), and can be conveyed to particular portlets for their use.)
Note that by default there's no user attribute "email".
Step 2: Edit the personDirectoryContext.xml
Edit personDirectoryContext.xml, adding to it an additional mapping for the email attribute.
The file to be edited is at
/up31seminar/uPortal-3.1.0-M2-quick-start/uPortal-3.1.0-M2/uportal-impl/src/main/resources/properties/contexts/personDirectoryContext.xml
This property declaration:
<entry key="EMAIL" value="mail" />
Should be changed to
<entry key="EMAIL"> <set> <value>mail</value> <value>email</value> </set> </entry>
It's a small thing, but this change will result in the email address being available as an attribute named "email" as well as an attribute named "mail".
The personDirectoryContext.xml file as it ships with uPortal 3.1.0 M2 is available from SVN, so if you accidentally mangle the file and want the original back, you can simply replace the file with a fresh copy.
Likewise, the personDirectoryContext.xml with the described change is attached (or included in an "after" folder alongside this PDF if you're reading this as a PDF in the context of the seminar), so if you'd like to proceed straight to the solution rather than bother with pasting bits of XML, feel free to copy that "after" personDirectoryContext.xml file into place.
Step 3: Be sure your portal is stopped
Step 4: Run the Ant deploy-war to deploy the modified uPortal
cd /up31seminar/uPortal-3.1.0-M2-quick-start/uPortal-3.1.0-M2 ../ant.sh deploy-war
Step 5: Start the portal again
After you wait for uPortal to start up, you can see it in your web browser at
http://localhost:8080/uPortal/
Step 6: Try it out
When you log in as admin, you should now see the user attribute "email" available in addition to the attribute "mail" that was previously available.