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


No comments:

Post a Comment