Exposing the Publish Console in the Contributor UI for WCS 11g

来源:互联网 时间:1970-01-01

Introduction

When working on a WebCenter Sites project, the differing user requirements might bring us to a point where customizations are required to the interface. Thereby enabling easy access to functionality that the user group requires.

One common contributor requirement is to have the Publish Console available through the Contributor Interface.

In a general scenario, WCS has two kind of users: Administrators and Contributors; each one with specific responsibilities and access requirements that can be easily managed with the OOTB setup. However in some cases we can have different levels of administration as well as multiple types of contributors, each one with different requirements and UI needs.

In these cases there might be Administrator users that are required only to access to Publish Console and fire on-demand publish sessions, verify the assets that are sitting on a publish queue or validate the assets that are keeping another asset in held state and away from the destination system. With the normal UI of WCS 11g, you would need to grant the user access to Admin UI and then they would need to switch app from Contributor to Admin UI in order to access the publish console. However this exposes the Admin App, potentially containing other tools and configuration settings that are undesirable to expose to the user. Therefore making the publish console available directly inthe Contributor UI might be not only a nice-to-have shortcut but also a security design decision to control what specific users can see in the system.

The Solution

WCS provides a good structure that allows us to create specific customizations in an easy to maintain way. With a few simple steps we will have the publish console included in the UI quickly.

Summary

The following will be required:

Create a CSElement to present the Publish Console in a frameset Create a SiteEntry for (1) Create a CustomConfigHtml CSElement to indicate a UI customizations Create a CustomConfigHtml CSElement under CustomElements containing the UI customization configuration.

Code is included here as POC and should be modified for any production deployment purposes.

1. Creating the PublishConsoleWrapper CSElement

The Publish Console was created to work in the Admin UI which uses a set of frames to display content in a browser window. If we just call the publish console right away without any frame some things won't work, like the “Cancel” button when you're checking a specific Publish Destination. An easy workaround for this issue is to create a wrapper that will give the console the frame structure it needs. For this we will create a PublishConsoleWrapper CSElement with the following code:

<%@ taglib prefix="cs" uri="futuretense_cs/ftcs1_0.tld"%><%@ taglib prefix="ics" uri="futuretense_cs/ics.tld"%><%@ taglib prefix="render" uri="futuretense_cs/render.tld"%><%@ page import="COM.FutureTense.Interfaces.*, COM.FutureTense.Util.ftMessage, COM.FutureTense.Util.ftErrors"%><cs:ftcs><%-- custom/PublishConsoleWrapperINPUTOUTPUT--%><%-- Record dependencies for the SiteEntry and the CSElement --%><ics:if condition='<%=ics.GetVar("seid")!=null%>'><ics:then><render:logdep cid='<%=ics.GetVar("seid")%>' c="SiteEntry"/></ics:then></ics:if><ics:if condition='<%=ics.GetVar("eid")!=null%>'><ics:then><render:logdep cid='<%=ics.GetVar("eid")%>' c="CSElement"/></ics:then></ics:if><frameset><frame name="XcelAction" src="ContentServer?pagename=OpenMarket/Xcelerate/Actions/PublishConsoleFront"></frameset></cs:ftcs>

In this code we're creating a <frameset> with only one frame named “XcelAction”. This is the set that would contain the main pane on the Admin UI and is referenced in the Publish Console for some actions. In that frame, src is set to ContentServer?pagename=OpenMarket/Xcelerate/Actions/PublishConsoleFront which is the pagename for the OOTB Publish Console.

2. Creating the SiteEntry

In order to access the above CSElement from a URL, we need to create a SiteEntry. This can be configured as follows:

Please note that we're setting both Wrapper page and Pagelet only attributes to false so that we can access this entry from outside and it won't be cached.

3. Create a CustomConfigHtml Hook.

Now that the wrapper is ready, we need to create a CSElement hook that will allow us to override the normal configuration of the menu bar in the Contributor UI.

For this we will create a new CSElement under UI/Config/CustomConfigHtml using the Advance Interface or Sites Explorer. This will be a JSP element and will contain the following code:

font-size: small; font-family: 'Courier New', monospace;"><%@ taglib prefix="cs" uri="futuretense_cs/ftcs1_0.tld"%><%@ taglib prefix="ics" uri="futuretense_cs/ics.tld"%><%@ taglib prefix="satellite" uri="futuretense_cs/satellite.tld"%><%@ page import="COM.FutureTense.Interfaces.FTValList"%><%@ page import="COM.FutureTense.Interfaces.ICS" %><%@ page import="COM.FutureTense.Interfaces.IList"%><%@ page import="COM.FutureTense.Interfaces.Utilities"%><%@ page import="COM.FutureTense.Util.ftErrors"%><%@ page import="COM.FutureTense.Util.ftMessage"%> <cs:ftcs><!-- user code here -->webcenter.sites['${param.namespace}'] = function (config) {// override this element in order to provide specific configuration settings// (CustomElements/UI/Config/CustomConfigHtml)}</cs:ftcs> 4. Create custom configuration

Now we have to create our actual Custom UI configuration. For this we create an element with the same name but under the CustomElements tree of the Catalog. In this case the element will be CustomElements/UI/Config/CustomConfigHtml and must contain the following code:

<%@ taglib prefix="cs" uri="futuretense_cs/ftcs1_0.tld" %><%@ taglib prefix="ics" uri="futuretense_cs/ics.tld" %><cs:ftcs>webcenter.sites['${param.namespace}'] = function (config) {config.menubar["default"].push({"id": "pubconsole","label": "Publication","children": [{"label": "Publish Console","action": function () {window.open("ContentServer?pagename=custom/PublishConsoleWrapper","PubConsole","status=0,toolbar=0,location=0,resizable=1,scrollbars=1,width=900,height=600");}}]});}</cs:ftcs>

As you can see in the code, in the action attribute of the Publish Console child, we're including a JavaScript function to open a new window calling the wrapper we created before. Once done with this step, you can refresh your browser window and check the Contributor UI, you will see something like this in your menu bar:

And when you click on the Publish Console Menu, you will see the following window open:

Security Notes

Now that the Publish Console is available in Contributor UI, you should have in mind some security considerations:

Only users with xcelpublish ACL will be able to access the Publish Console. Any user who doesn't have that ACL will get an error message stating they don't have access to this function.

If the user gets access to the publish console he will also be able to access the configuration of Publish Destinations and Scheduled Publish Events. Changes on these configurations can affect or completely disable the publishing process so users most be fully aware of the implications of any change in this.

More customizations.

For more examples of how to customize the Contributor Interface see: https://apexapps.oracle.com/pls/apex/f?p=44785:24:::NO::P24_CONTENT_ID,P24_PREV_PAGE:7285,2

(Special thanks to Mark Fincham for reviewing this post)



相关阅读:
Top