Showing posts with label custom. Show all posts
Showing posts with label custom. Show all posts

Saturday, October 12, 2013

workspace.getById() throws AuthorisationException

Recently came across a requirement to migrate JSP component scripts from 6.1 to 8. In the process of migration found that workspace.getById() WCM API call is not functioning. 

Looking at the logs one could see following kind of error

com.aptrix.pluto.security.AuthorisationException: IWKPY1015X: 
Unauthorised access by {{, employeenumber=11111111,ou=people,ou=b2e,ou=ebusiness, 8ef21840-54a0-102c-96c8-950414f94614, fi, Type: User}, 4, {false, {userAccess={}}, {editorAccess={}}, {managerAccess={}}, [all_auth_portal_users%all_auth_portal_users_group_id, anonymous_user%anonymous_user_id, all_users%all_users_group_id


The surprising thing is this happens in-spite of giving "Anonymous user access" 
When looked at the details found following 

In Websphere Portal 8, WCM API calls from custom JSPs by default relies on "Contributor" access to the target content. 

If one wants to override this rule could place following call just before the getById() call.

workspace.useUserAccess(true)


Ref: https://www-304.ibm.com/support/docview.wss?uid=swg21399507


Thursday, March 22, 2012

How to create custom skin in the wps7


        1.     Setup WEBDAV for skinlist folder and open
           http://localhost:10039/wps/mycontenthandler/dav/skinlist
        2.     Copy folder "csa2.standard"  to you local directory and rename
           to "csa2.standardCustom"
        3.     Inside csa2.standardCustom/metadata edit the
           localized_xx.properties and change the value of the property
           title
 


        4.     Just for verification, lets had little customization to the
           skin by editing csa2.standardCustom/nls/skin_en.html
        5.     Add text "Title:" as shown in the bellow snippet

            <span class="lm-dynamic-title asa.portlet.title
            decoration-title">Title:<a rel="dynamic-content"
            href="lm:title"></a></span>

        6.     Move the "csa2.standardCustom" to the
           http://localhost:10039/wps/mycontenthandler/dav/skinlist
           through WEBDAV
        7.     You could double check the addition of this skin in you portal
           by going to Administration/Portal User Interface/Themes and
           Skins/Skins.



        8.     Now you could add this skin to Page Builder theme by clicking
           on "Edit theme"
        9.     Select "Page Builder – Standard Custom" (this is the tile we
           given in properties file) and click right arrow to add it to
           "Skins for this theme". Finally click OK
       



        10.    Now the skin is ready to apply for a portlet. Go the Edit
           layout for page>Appearance tab>Skin (under a Portlet)



        11.    Bellow is the screen shot of the rendering of the Portlet
           which uses this customized skin. Please note the text "Title:"
           prefixed in the Portlet title bar.

Tuesday, March 20, 2012

Dynamic Portlet Title in JSR286 portlet

Dear All,

I recently came across a need to achieve dynamic portlet title. I came across many articles and methodologies. But bellow one is the simplest and most elegant one that I used.

As per JSR286 portlet specification, we are allowed to override getTitle method of GenericPortlet

Ref: http://portals.apache.org/pluto/portlet-2.0-apidocs/javax/portlet/GenericPortlet.html#getTitle%28javax.portlet.RenderRequest%29

so I placed following method in my Porlet Class which extends GenericPortlet


public java.lang.String getTitle(RenderRequest request) {
return "My custom title";
}


The execution of this getTitle is subject to container runtime settings. So dont forget to set javax.portlet.renderHeaders to true under container-runtime-option in portlet.xml


Now you can extend this concept by retrieving a portlet preferences and use it as portlet title.