Specifying Different Configuration Files for Different Users in IWWCM 2.5/5.1/5.1.0.1
The Ephox integrations into IWWCM allow developers to load different configurations of the editor based on the user.
This article outlines how to achieve this functionality in the Ephox integrations into IWWCM 2.5/5.1/5.1.0.x.
Step 1) Create the Desired Configuration Files
EditLive! configurations are specified by using an EditLive! Configuration File. Ephox provides a free of charge tool for easily creating and editing these configuration files. This tool can be downloaded from the Ephox website at http://www.ephox.com/product/editliveforjava/configuration/6.0/ConfigTool.jnlp.
Create a new configuration file for each desired user or user group. Give each configuration file a unique name (e.g. adminConfig.xml, docReviewerConfig.xml).
Step 2) Edit the Ephox Integration to Define the Current User
Open the ephoxDefineUser.jsp file located in the ephox/instantiation directory for your IWWCM installation.
For example:
IWWCM 5.1/5.1.0.x: C:\IBM\PortalServer\installedApps\WCM_Authoring_UI__PA_1_0_CH.ear\PA_1_0_CH.war IWWCM 2.5: C:\IBM\PortalServer\installedApps\ilwwcm-aut_ng-portlet_UI__PA_1_0_CH.ear\PA_1_0_CH.war
Use the work.getUserProfile().getUsername() call to print the user's name.
Use the work.isMemberOfGroup("NAME") call to check if the current user belongs to the specified group.
A combination of these calls can be used to define which configuration file is called. For example, the following code would catch whether the user belonged to the "wpsadmins" user group, or failing that, whether the user's name is "wpsguest".
<%
if(work.isMemberOfGroup("wpsadmins")) {
// load configuration file A
} else {
if(work.getUserProfile().getUsername().equals("wpsguest")) {
// load configuration file B
} else {
// load default configuration file
}
}
%>
Step 3) Define the Configuration Files
Finally, use the setConfigurationFile load-time property for EditLive! to specify your EditLive! configuration file. Use the portletResponse.encodeURI Java call to generate a reference to the ephox/editlivejava directory in your IWWCM installation in order to correctly reference the desired configuration file.
<%
if(work.isMemberOfGroup("wpsadmins")) {
out.println(eljNamespace + "elj.setConfigurationFile(\"" +
portletResponse.encodeURI("/ephox/editlivejava/adminConfig.xml") + "\");");
} else {
if(work.getUserProfile().getUsername().equals("wpsguest")) {
out.println(eljNamespace + "elj.setConfigurationFile(\"" +
portletResponse.encodeURI("/ephox/editlivejava/docReviewerConfig.xml") + "\");");
} else {
out.println(eljNamespace + "elj.setXMLURL(\"" +
portletResponse.encodeURI("/ephox/editlivejava/standard_eljconfigxml.jsp?editorName=" +
eljNamespace + "&directoryRef=" + directoryRefString) +
"&jspContext=" + URLEncoder.encode(URLEncoder.encode(jspContext)) +"\");");
}
%>

