Skip to Content

Searching and displaying Roles for a user

Hi,

I want to access roles, worksets, iviews for logged on user.

I am using following piece of code which gives me ALL roles and other PCD contents in portal.

IUser iUser = WDClientUser.getCurrentUser().getSAPUser();
Hashtable env = new Hashtable();
env.put(IPcdContext.SECURITY_PRINCIPAL, iUser);
env.put(Context.INITIAL_CONTEXT_FACTORY,IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
env.put(com.sap.portal.directory.Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
		
InitialContext ctx = null;
DirContext dirCtx;
ctx = new InitialContext(env);
dirCtx = (DirContext) ctx.lookup("pcd:portal_content/");
		
PcdSearchControls pcdSearchControls = new PcdSearchControls();
pcdSearchControls.setReturningObjFlag(false);
pcdSearchControls.setSearchScope(PcdSearchControls.SUBTREE_WITH_UNIT_ROOTS_SCOPE);
dirCtx.addToEnvironment(com.sap.portal.directory.Constants.APPLY_ASPECT_TO_CONTEXTS, com.sap.portal.directory.Constants.APPLY_ASPECT_TO_CONTEXTS);

NamingEnumeration ne = dirCtx.search("","(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.role)",pcdSearchControls);

Any idea how can I get details of the roles for specific user (in this case, logged on user)?

Thanks and regards,

Amey

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jun 28, 2010 at 09:08 AM

    hi amey,

    check this thread

    fetch PCD and UME roles and worksets

    hope you solve your issue

    regards,

    Maheshchandra.

    ( Little bit search helps you more rather than posting the same type of Questions)

    Edited by: maheshchandra.lanco on Jun 28, 2010 11:11 AM

    Add comment
    10|10000 characters needed characters exceeded