How To
ForgeRock Identity Platform
Does not apply to Identity Cloud

How do I make individual user profile attributes read-only in AM (All versions)?

Last updated Apr 13, 2021

The purpose of this article is to provide information on making individual user profile attributes read-only in AM. You would do this if you want to prevent end users from changing certain fields shown on the XUI User Profile page.


1 reader recommends this article

Making individual user profile attributes read-only (AM 6 and later)

Changes have been made in AM 6 to optimize XUI delivery using Webpack as detailed in the Release Notes › Major Improvements (General).

You can make individual user profile attributes read-only as follows:

  1. Follow the steps in UI Customization Guide › Downloading the XUI to obtain the XUI source.
  2. Edit the UserProfileTemplate.html file (located in the /am-external/openam-ui/openam-ui-user/src/resources/themes/default/templates/user directory for AM 7 and later, or /am-external/openam-ui/openam-ui-ria/src/main/resources/templates/user directory for AM 6.x) and add readonly=true to any attributes you want to make read-only. For example, the amendments would look like this to make First Name and Last Name read-only: <div class="panel-body">    {{#user}}         {{> form/_basicInput property="username" label="common.user.username" readonly=true}}         {{> form/_basicInput property="givenName" label="common.user.givenName readonly=true"}}         {{> form/_basicInput property="sn" label="common.user.sn" required="true readonly=true"}}         {{> form/_basicInput type="email" property="mail" label="common.user.emailAddress"         extraAttributes='data-validator="validEmailAddressFormat" data-validator-event="keyup"' }}         {{> form/_basicInput type="tel" property="telephoneNumber" label="common.user.phoneNumber"         extraAttributes='data-validator="validPhoneFormat" data-validator-event="keyup"'}}     {{/user}} </div>
  3. Follow steps in UI Customization Guide › Testing and Deploying the XUI to test your changes, then rebuild and deploy.

The User Profile page now shows the First Name and Last Name fields have been grayed out to indicate the values in these fields are hard-coded :

Making individual user profile attributes read-only (AM 5.x)

The following process demonstrates making the First Name and Last Name on the User Profile page read-only in AM 5.x:

  1. Edit the UserProfileTemplate.html file (located in the /path/to/tomcat/webapps/openam/XUI/templates/user directory) and add readonly=true to any attributes you want to make read-only. For example, the amendments would look like this to make First Name and Last Name read-only: <div class="panel-body">    {{#user}}         {{> form/_basicInput property="username" label="common.user.username" readonly=true}}         {{> form/_basicInput property="givenName" label="common.user.givenName readonly=true"}}         {{> form/_basicInput property="sn" label="common.user.sn" required="true readonly=true"}}         {{> form/_basicInput type="email" property="mail" label="common.user.emailAddress"         extraAttributes='data-validator="validEmailAddressFormat" data-validator-event="keyup"' }}         {{> form/_basicInput type="tel" property="telephoneNumber" label="common.user.phoneNumber"         extraAttributes='data-validator="validPhoneFormat" data-validator-event="keyup"'}}     {{/user}} </div>
  2. Clear your browser cache.

The User Profile page now shows the First Name and Last Name fields have been grayed out to indicate the values in these fields are hard-coded :

Note

You must make these changes in the openam.war file to make them permanent.

See Also

How do I make a whole user data store read-only to users in AM (All versions)?

FAQ: Customizing, branding and localizing XUI end user pages in AM

UI Customization Guide

Related Training

N/A

Related Issue Tracker IDs

N/A


Copyright and Trademarks Copyright © 2021 ForgeRock, all rights reserved.