Skip to Content
avatar image
Former Member

How can I fetch all the PCD roles from EP!

Hello,

I need to fetch all the available pcd roles in EP. Right now I am trying to fetch pcd roles under Portal Content directory. I need a clarification whether this is the only place the pcd roles are available or is there any other location where rest of the pcd roles are available?

Thanks in advance,

Prashanth V Swamy

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Apr 27, 2006 at 01:27 PM

    Hi Prashanth,

    As of I know all the PCD Roles created in EP will be stored under PCD and not somewhere else.

    As you are retrieving all the roles from PCD its enough and no need to get confused.

    Regards,

    Karthick Eswaran

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 27, 2006 at 01:28 PM

    Hi,

    Im not sure if i've got this right. But if you go to User Administration > Roles and then select 'roles' from the drop down list and click start, all the roles will be displayed.

    Hope it helps

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 27, 2006 at 01:30 PM

    Hi Prasanth,

    See the code below to retrieve all the pcd roles.

    public List getPCDContents(IPortalComponentRequest request) throws Exception{

    try{

    Hashtable env = new Hashtable();

    env.put(IPcdContext.SECURITY_PRINCIPAL, request.getUser());

    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;

    List roleList = null;

    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(

    Constants.APPLY_ASPECT_TO_CONTEXTS,

    Constants.APPLY_ASPECT_TO_CONTEXTS);

    NamingEnumeration ne =

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

    pcdSearchControls);

    iViewList = new ArrayList();

    while (ne.hasMoreElements()) {

    IPcdSearchResult searchResult =

    (IPcdSearchResult) ne.nextElement();

    String location = "pcd:portal_content/" + searchResult.getName();

    //Get the full pcd path of the iview.

    roleList.add(location);

    }

    return iViewList;

    }catch(Exception e ){

    throw new Exception(e);

    }

    }

    Hope it helps.

    Regards,

    Karthick

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 27, 2006 at 01:32 PM

    Hi Prashanth,

    We will get roles from two places. From PCD and another is LDAP. If you want to get PCD rooles search with RoleSearchFilters and Enumerate.

    Just have a look this example

    IRoleFactory iRoleF = UMFactory.getRoleFactory();

    IRoleSearchFilter roleFlt = iRoleF.getRoleSearchFilter();

    roleFlt.setUniqueName("*",ISearchAttribute.EQUALS_OPERATOR,false);

    ISearchResult rslt1 = iRoleF.searchRoles(roleFlt);

    if ( rslt1.getState() == ISearchResult.SEARCH_RESULT_OK ){

    while (rslt1.hasNext()){

    String roleUid = rslt1.next().toString();

    ...........

    }

    }

    Best Regards,

    Raja

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi ,

      You need the following jars in order to get PCD contents.

      1.com.sap.portal.pcd.glservice_api.jar

      2.com.sap.portal.pcm.admin.apiservice_api.jar

      3.com.sap.portal.ivs.api_portalpcm_api.jar

      4.gl_api.jar

      5.prtapi.jar

      6.concurrency.jar

      7.com.sap.portal.ivs.api_landscape_api.jar

      Thanks and Regards

      Radhika Kuthiala