Month: May 2014

Adding Edit Capability to WebCenter Profile page

In my previous post about being able to update user profiles programmatically it assumed that the user had the capability to edit the profile.

There were some additional configuration steps required to be able to get this to work in a controlled way which are explained below. The easy way would be to add the “Manage People Connections” permission to the “Authenticated-User” role, however, this gives more capability that we really want. The steps below are aimed at only enabling edit capability.

Adding general permission to the authenticated-user role
1. Login to WebCenter using weblogic
2. Click Administration then click Security
3. Scroll right on the Roles table (note you have to scroll to the bottom first to see the scrollbar)
4. The Authenticated-User role in the table should be on the right hand side. Enable “Update People Connections Data” and then click Apply at the top of the page.

Enable the application policy
1. Login to Enterprise Manager
2. Navigate to Farm_base_domain->Weblogic Domain->base_domain
3. Right click on base_domain and then select Security->Application Policies.
4. Search for the right policy using the details:
a. Application Stripe: webcenter
b. Principal Type: Application Role
c. Name (Includes): authenicated
5. Select Principal “authenticated-user” and click Edit
6. In the Permissions section click the Add button.
7. Select “oracle.webcenter.peopleconnections.profile.security.ProfilePermission” from the Permission Class dropdown.
8. Enter “/oracle/webcenter/peopleconnections/profile/s8bba98ff_4cbb_40b8_beee_296c916a23ed/.*” in the Resource Name section and click the blue search arrow button.
9. Select the line that has the “Edit” Permission Action
10. Click Continue then OK

Updating a user’s WebCenter Profile programmatically

There are many details stored in a user’s profile and sometimes it needs to be controlled what is updated and how. This means that using the standard edit capability in the WebCenter profile screen isn’t possible.

To get around this you can create a custom taskflow that that permits and validates the changes to the profile. The challenge that I found when working on this was how to get the user’s profile, update it and get WebCenter to invalidate the cached profile object that it had stored.

Whilst hunting through the APIs I found a WCUserProfile class that looked like it fitted my needs and also it had a save(); method on the object. I had a go at retrieving the profile and updating it then calling save(); and it worked.


  private void updateAndSaveUserProfileChanges(String username) throws ProfileException {
    WCUserProfile userProfile = this.userProfileManager.getProfileForUpdate(username);
    userProfile.setFirstName("John");
    userProfile.setLastName("Smith");
    userProfile.setBusinessEmail("john.smith@somewhere.com");
    userProfile.save();
  }

Note that getProfileForUpdate was used to get the WCUserProfile object, there is another getProfile command without the update. I opted for the getProfileForUpdate because I was updating it but the JavaDoc wasn’t too helpful I found.

The one thing I haven’t solved with this change is the About screen in WebCenter still has cached content in the user’s session. Logging out and back in clears this and the About page in the User’s Profile then shows the updated information.