Liferay User Profile Input Fields Disable/Enable

Liferay have given way to enable/disable user my account input fields through the properties and this is good way to enable/disable fields rather than create some JSP hooks.

Generally when we want change some User Interface in Liferay Portal Portlets we will create JSP hooks or JSP Adopter hooks to handle these kind of scenarios.

But Liferay have given some properties so that we can enable or disable user my account/my profile input fields.

Assume some scenario some time we don’t want give edit option to change email address or screen name of user in the my account page and this scenarios we can handle it from properties.

Assume some time we import all accounts from LDAP to Liferay database but we don’t want give some edit permission to some important fields like screen name, email address.

Liferay used some kind of logic that based on domain names in email address so that it can control the input fields edit/no-editable permissions through defined properties.

Generally create account page as follows and most of the fields are editable.



Scenario: 1

Assume all email addresses with @liferay.com give editable option other email address ends with any other domain we should not give edit options in my account input fields.

Scenario: 2

Only email address not editable in the account page.

Scenario: 3

Assume email address input only editable if it ends with @liferay.com and all other email address it should not be editable and other fields are editable.

All these scenarios we can achieve just change the properties so that we can achieve.
You can add following properties in the portal-ext.properties file then restart server so that you see result in the user my account page.

Scenario: 1

Assume all email addresses with @liferay.com give editable option other email address ends with any other domain we should not give edit options in my account input fields.


field.editable.user.types=
field.editable.domains=liferay.com


You can pass multiple domain names as COMMA separatedvalues so that input fields editable to particulate domain email address users input fields.

Fields Editable for email address ends with @liferay.com



  
All fields non editable if the email address not ends with @liferay.com



 Scenario: 2

Only email address not editable in the account page

The following case email input filed not editable for @liferay.com and @gmail.com but other all input fields are editable.


field.editable.user.types=
field.editable.domains[emailAddress]=
field.editable.domains[firstName]=liferay.com,gmail.com
field.editable.domains[gender]=liferay.com,gmail.com
field.editable.domains[jobTitle]=liferay.com,gmail.com
field.editable.domains[lastName]=liferay.com,gmail.com
field.editable.domains[middleName]=liferay.com,gmail.com
field.editable.domains[portrait]=liferay.com,gmail.com
field.editable.domains[prefix]=liferay.com,gmail.com
field.editable.domains[screenName]=liferay.com,gmail.com
field.editable.domains[suffix]=liferay.com,gmail.com
field.editable.domains[birthday]=liferay.com,gmail.com



The following account email address ends with @liferay.com only email input is not editable all other are editable



The following account email address ends with @gmail.com only email input is not editable all other are editable



Scenario: 3

Assume email address input only editable if it ends with @liferay.com and all other email address it should not be editable and other fields are editable.


field.editable.user.types=
field.editable.domains[emailAddress]=liferay.com
field.editable.domains[firstName]=liferay.com,gmail.com
field.editable.domains[gender]=liferay.com,gmail.com
field.editable.domains[jobTitle]=liferay.com,gmail.com
field.editable.domains[lastName]=liferay.com,gmail.com
field.editable.domains[middleName]=liferay.com,gmail.com
field.editable.domains[portrait]=liferay.com,gmail.com
field.editable.domains[prefix]=liferay.com,gmail.com
field.editable.domains[screenName]=liferay.com,gmail.com
field.editable.domains[suffix]=liferay.com,gmail.com
field.editable.domains[birthday]=liferay.com,gmail.com


The following account email address ends with @liferay.com so all input are editable including email input




The following account email address not ends with @liferay.com so email input is not editable and other input fields are editable




 Note:

The properties you have to place in portal-ext.properties file and this file available in Liferay Home Directory/Portal Server Parent Directory

We can also use “portal-setup-wizard.properties” to place the properties and this file available in Liferay Home Directory/Portal Server Parent Directory

All the cases administrator have power to edit their fields even we disable.

The following is the description about field.editable.user.types


Input a list of comma delimited user types. Users that match one of these user types have permission to edit all of their own fields. Valid user types are "user-with-mx" and "user-without-mx". A value of "user-with-mx" is a user who has an email address that matches the company mail suffix, and "user-without-mx" is a user who does not have an email address that matches the company mail suffix.

 field.editable.user.types=user-with-mx,user-without-mx




Author
Share on Google Plus

About Meera Prince

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment