This document was generated from CDN thread
Created by: Alan Coe on 27-03-2012 09:47:09 AM
The Cisco IWE implementation features a News portlet that is used for Corporate News and Announcements. This portlet is enforced in that a user can not move or remove.
Is there any guidance available on how this is achieved?
Regards,
Alan
Subject: RE: Fixed / Non-movable Portlet for Corporate Announcements etc
Replied by: ROD TAGUCHI on 27-03-2012 03:35:54 PM
I sure would like this one too.
for the Cisco Collaboration Partner summit, we modified the Content Publisher portlet for this capability.... we removed the ability to remove the portlet from the My View page along with the ability to edit content. The elegant way to do this is to create a new portlet specifically for this purpose, and only allow administrator to EDIT and remove ability for end users to edit content or remove the portlet from their MyView or Community page.
Subject: RE: Fixed / Non-movable Portlet for Corporate Announcements etc
Replied by: Christopher Chandler on 13-04-2012 12:00:45 PM
Folks,
Here's a Post I created internally after doing the same for a recent customer rollout.
Hope that helps!
Cheers,
Chris
******************
<h1 id="1Overview" style="padding-top: 8px; padding-right: 0px; padding-bottom: 12px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 22px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: arial, sans-serif; line-height: normal; color: #52636a; margin: 0px; border: 0px initial initial;">Overview</h1>
Some customers may wish to control Portlet behaviors for their end users. This Post will cover some common Portlet permission customizations, namely:
<ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; list-style-position: outside; list-style-image: initial; color: #333333; font-family: arial, sans-serif; line-height: 15px; padding: 0px; border: 0px initial initial;">
<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 17px; background-position: initial initial; background-repeat: initial initial; border: 0px initial initial;">Prevent the ability to delete a Portlet</li>
<li style="margin-top: 9px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 17px; background-position: initial initial; background-repeat: initial initial; border: 0px initial initial;">Prevent the ability to configure a Portlet</li>
<li style="margin-top: 9px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 17px; background-position: initial initial; background-repeat: initial initial; border: 0px initial initial;">Prevent non-Administrators from being able to add a Portlet to My View or My Profile</li>
</ul>
<h1 id="2Procedure" style="padding-top: 8px; padding-right: 0px; padding-bottom: 12px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 22px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: arial, sans-serif; line-height: normal; color: #52636a; margin: 0px; border: 0px initial initial;">Procedure</h1>
In this section, we will cover the steps required to implement the changes above.
<strong style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;">Note: Unless otherwise specified, the files mentioned live in the following location: /opt/cisco/WebEx Social/tomcat/ROOT/WEB-INF/.
<strong style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;">Also note: After making all of the changes to the various XML files listed
<h2 id="2_1Prevent_the_ability_to_delete_a_Portlet" style="padding-top: 8px; padding-right: 0px; padding-bottom: 12px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: arial, sans-serif; line-height: normal; color: #52636a; margin: 0px; border: 0px initial initial;">Prevent the ability to delete a Portlet</h2>
In some cases, you may want to ensure that end users can not delete a particular Portlet. This is accomplished by modifying portlet.xml to include the following Portlet preference for the Portlet in question:
<pre style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #333333; line-height: 15px; padding: 0px; margin: 0px; border: 0px initial initial;"><code style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;"><preference>
<name>portlet-setup-show-borders</name>
<value>false</value>
</preference>
</code></pre>
<strong style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;">Note: For certain portlets - like the Open Social Gadget - you will not see that portlet listed in the main porlet.xml. Instead, each of these special portlets has its own portlet.xml that lives under ../webapps/<Portlet_Name>/WEB-INF.
For example, to make these changes for the Open Social Gadget, you will need to modify the following file: /opt/cisco/WebEx Social/tomcat/webapps/opensocial-spring-portlet/WEB-INF/portlet.xml.
<h2 id="2_2Prevent_the_ability_to_configure_a_Portlet" style="padding-top: 8px; padding-right: 0px; padding-bottom: 12px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: arial, sans-serif; line-height: normal; color: #52636a; margin: 0px; border: 0px initial initial;">Prevent the ability to configure a Portlet</h2>
In other cases - especially those where you pre-configure a Portlet with specific settings (e.g.: an iFrame that is pre-configured to point to a particular website) - it is desirable to prevent the end user from changing the settings of the Portlet.
This can be accomplished by deleting the <strong style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;">configuration-action-class tag for the Portlet in question.
For example to remove the abiility for users to configure the iFrame Portlet, you would delete this line within the portlet tag in liferay-portlet-ext.xml:
<pre style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #333333; line-height: 15px; padding: 0px; margin: 0px; border: 0px initial initial;"><code style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;"><configuration-action-class>com.liferay.portlet.iframe.action.ConfigurationActionImpl</configuration-action-class>
</code></pre>
The exact class name that lies inside the <strong style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;">configuration-action-class will differ depending on the Portlet, but the tag is always <strong style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;">configuration-action-class.
<h2 id="2_3Control_ability_to_add_a_Portlet" style="padding-top: 8px; padding-right: 0px; padding-bottom: 12px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: arial, sans-serif; line-height: normal; color: #52636a; margin: 0px; border: 0px initial initial;">Control ability to add a Portlet</h2>
In this section, we will cover the steps to control who can to add a Portlet in My View, My Profile, and/or Communities.
The file liferay-display dictates what Portlets show up in My View, My Profile, and Communities. It also allows you to specify what Portlets should only be visible to System Administrators. These are referred to in liferay-display.xml, respectively, as:
<ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; list-style-position: outside; list-style-image: initial; color: #333333; font-family: arial, sans-serif; line-height: 15px; padding: 0px; border: 0px initial initial;">
<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 17px; background-position: initial initial; background-repeat: initial initial; border: 0px initial initial;">category name=“category.myview”</li>
<li style="margin-top: 9px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 17px; background-position: initial initial; background-repeat: initial initial; border: 0px initial initial;">category name=“category.myprofile”</li>
<li style="margin-top: 9px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 17px; background-position: initial initial; background-repeat: initial initial; border: 0px initial initial;">category name=“category.community”</li>
<li style="margin-top: 9px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 17px; background-position: initial initial; background-repeat: initial initial; border: 0px initial initial;">category name=“category.advanced”</li>
</ul>
Also, while we will not talk about it here, there is another category - category.hidden - that can be used to hide Portlets from all users. However, this is more easily achieved by going to Plugin Settings and disabling the “plugin” (AKA: Portlet).
<h3 id="2_3_1Understanding_liferay-display_xml" style="padding-top: 17px; padding-right: 0px; padding-bottom: 12px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: arial, sans-serif; line-height: normal; color: #52636a; margin: 0px; border: 0px initial initial;">Understanding liferay-display.xml</h3>
Here is an example of what the beginning of the category.myprofile section looks like:
<pre style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #333333; line-height: 15px; padding: 0px; margin: 0px; border: 0px initial initial;"><code style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;"><category name="category.myprofile">
<portlet id="28" /> <!-- Bookmarks -->
<portlet id="20" /> <!-- Document Library -->
<portlet id="31" /> <!-- Image Gallery -->
<portlet id="48" /> <!-- IFrame -->
</code></pre>
As you can see, it is simply a list of portlet tags that cite the Portlet IDs, along with an optional (but <strong style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;">highly recommended) description of the Portlet. This description is not visible in the WebEx Social UI. It is simply there for the Admin’s reference.
By adding - or removing - portlet tags, we can dictate which Portlets show in various parts of the WebEx Social UI.
<strong style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;">Note: For certain portlets - like the Open Social Gadget - you will not see that portlet listed in the main liferay-display.xml. Instead, each of these special portlets has its own liferay-display.xml that lives under ../webapps/<Portlet_Name>/WEB-INF.
For example, to make these changes for the Open Social Gadget, you will need to modify the following file: /opt/cisco/WebEx Social/tomcat/webapps/opensocial-spring-portlet/WEB-INF/liferay-display.xml.
<h3 id="2_3_2Example_Use_Case" style="padding-top: 17px; padding-right: 0px; padding-bottom: 12px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: arial, sans-serif; line-height: normal; color: #52636a; margin: 0px; border: 0px initial initial;">Example Use Case</h3>
Consider the following example use case: The iFrame portlet:
<ol style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 21px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; list-style-position: outside; list-style-image: initial; color: #333333; font-family: arial, sans-serif; line-height: 15px; border: 0px initial initial;">
<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 17px; background-position: initial initial; background-repeat: initial initial; border: 0px initial initial;">Should not be available in My View for non-System Administrators</li>
<li style="margin-top: 9px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 17px; background-position: initial initial; background-repeat: initial initial; border: 0px initial initial;">Should not be available in My Profile for non-System Administrators</li>
<li style="margin-top: 9px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 17px; background-position: initial initial; background-repeat: initial initial; border: 0px initial initial;">Should be available for all Community Owners and Administrators, even those who are not System Administrators</li>
</ol>
To accomplish this, we would do the following:
<ol style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 21px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; list-style-position: outside; list-style-image: initial; color: #333333; font-family: arial, sans-serif; line-height: 15px; border: 0px initial initial;">
<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 17px; background-position: initial initial; background-repeat: initial initial; border: 0px initial initial;">Under category.myview, delete the portlet tag: <portlet id=“48” /> <!– IFrame –></li>
<li style="margin-top: 9px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 17px; background-position: initial initial; background-repeat: initial initial; border: 0px initial initial;">Under category.myprofile, delete the portlet tag: <portlet id=“48” /> <!– IFrame –></li>
<li style="margin-top: 9px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 17px; background-position: initial initial; background-repeat: initial initial; border: 0px initial initial;">Under category.advanced, add the portlet tag: <portlet id=“48” /> <!– IFrame –></li>
</ol>
Steps 1 and 2 remove the iFrame Portlet from the Add Applications pane for all users. Step 3 adds the iFrame Portlet back <strong style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;">only for System Administrators. We left the portlet tag for iFrame in category.community because we still want Community Owners and Administrators to be able to add iFrames to Communities they Administer.
As usual, normal Community Members will not have access to the iFrame portlet.
Subject: RE: Fixed / Non-movable Portlet for Corporate Announcements etc
Replied by: Christopher Chandler on 13-04-2012 12:02:51 PM
Attaching as a PDF, since this editor made a mess of the HTML.
Subject: RE: Fixed / Non-movable Portlet for Corporate Announcements etc
Replied by: John Kazmerzak on 19-04-2012 07:44:52 PM
Excellent information, thanks for posting!