Retreive a list of workets, iViews, pages from Roles

Hello All,
Im working on EP6 SP9 and trying to make an application which would retrieve following data of existing Portal users:
1> User ID
2> Roles assigned.
3> <b>Workets, iViews and Pages that are attached/assigned to the roles (referring to point 2 above).</b>
<i><b>Currently im able to retrieve a list of existing Portal users along with the roles assigned. But not being able to drill down further.</b></i>
Please help me.
Awaiting Reply.
Thanks and Warm Regards,
Ritu

Use the following code.
package co.ust.browserole;
import java.util.Hashtable;
import java.util.Iterator;
import javax.naming.Context;
import javax.naming.NameClassPair;
import javax.naming.NamingEnumeration;
import com.sap.ip.portal.service.ume.IUserManagementEngine;
import com.sap.security.api.IRole;
import com.sap.security.api.IUser;
import com.sap.security.api.UMException;
import com.sap.security.api.UMFactory;
import com.sap.security.api.srvUser.IServiceUserFactory;
import com.sapportals.htmlb.Form;
import com.sapportals.htmlb.page.DynPage;
import com.sapportals.htmlb.page.PageException;
import com.sapportals.portal.htmlb.page.PageProcessorComponent;
import com.sapportals.portal.pcd.gl.IPcdContext;
import com.sapportals.portal.pcd.pcm.builder.IPcmEditObject;
import com.sapportals.portal.pcd.pcm.builder.IPcmObjectBuilder;
import com.sapportals.portal.pcd.pcm.builder.IPcmObjectService;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentResponse;
import com.sapportals.portal.prt.runtime.PortalRuntime;
public class display extends PageProcessorComponent {
     public DynPage getPage() {
          return new displayDynPage();
     public static class displayDynPage extends DynPage {
           * Initialization code executed once per user.
          public void doInitialization() {
           * Input handling code. In general called the first time with the second page request from the user.
          public void doProcessAfterInput() throws PageException {
           * Create output. Called once per request.
          public void doProcessBeforeOutput() throws PageException {
               Form myForm = this.getForm(); // get the form from DynPage
               // create your GUI here....
               IPortalComponentResponse response =
                    (IPortalComponentResponse) this.getResponse();
               IPortalComponentRequest request =
                    (IPortalComponentRequest) this.getRequest();
               IPcmObjectService pcdFactory =
                    (IPcmObjectService) PortalRuntime
                         .getRuntimeResources()
                         .getService(
                         IPcmObjectService.KEY);
               Hashtable env = new Hashtable();
               env.put(
                    Context.INITIAL_CONTEXT_FACTORY,
                    IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
               env.put(
                    Context.SECURITY_PRINCIPAL,
                    this.getServiceUser("pcd_service"));
               IUser user = request.getUser();
               Iterator role = user.getRoles(true);
               String root;
               while (role.hasNext()) {
                    try {
                         String rolestr = (String) role.next();
                         IRole r = UMFactory.getRoleFactory().getRole(rolestr);
                         root = r.getUniqueName();
                         response.write(
                              "<b>" + r.getDisplayName() + "</b>" + "<br>");
                         recursive_role_content(root, pcdFactory, env);
                    } catch (Exception e) {
                         response.write(e.getMessage());
          public void recursive_role_content(
               String root,
               IPcmObjectService pcdFactory,
               Hashtable env)
               throws Exception {
               IPortalComponentResponse response =
                    (IPortalComponentResponse) this.getResponse();
               IPcmObjectBuilder pcmSrv = pcdFactory.getInitialContext(env);
               NamingEnumeration names = pcmSrv.list(root);
               while (names.hasMore()) {
                    NameClassPair nameclass = (NameClassPair) names.next();
                    String pcdurl = root + "/" + nameclass.getName();
                    IPcmEditObject pcmObj = (IPcmEditObject) pcmSrv.lookup(pcdurl);
                    response.write(
                         "Title: " + pcmObj.getTitle() + " Class Name" + pcmObj.getClass() + "<br>");
                    NamingEnumeration newnames = pcmSrv.list(pcdurl);
                    if (newnames.hasMore()) {
                         recursive_role_content(pcdurl,pcdFactory,env);
          public IUser getServiceUser(String username) {
               IPortalComponentResponse response =
                    (IPortalComponentResponse) this.getResponse();
               IUser serviceUser = null;
               IUserManagementEngine ume =
                    (IUserManagementEngine) PortalRuntime
                         .getRuntimeResources()
                         .getService(
                         IUserManagementEngine.KEY);
               IServiceUserFactory sufactory = ume.getServiceUserFactory();
               try {
                    serviceUser = sufactory.getServiceUser(username);
               } catch (UMException e) {
                    response.write(e.getMessage());
               return serviceUser;
<b>
Portalapp.xml should look following.</b>
<?xml version="1.0" encoding="utf-8"?>
<application>
  <application-config>
    <property name="PrivateSharingReference" value="com.sap.portal.htmlb,com.sap.portal.pcd.glservice,com.sap.portal.pcmbuilderservice"/>
  </application-config>
  <components>
    <component name="display">
      <component-config>
        <property name="ClassName" value="com.ust.browserole.display"/>
        <property name="SecurityZone" value="com.ust.browserole/high_safety"/>
      </component-config>
      <component-profile/>
    </component>
  </components>
  <services/>
</application>

Similar Messages

  • Retreive a list of workets,folders,iViews,pages from Roles

    Hi all,
    I have been working on retreiving the workset,folders,iview,pages from a role.
    i am refering to the code given in the forum thread
    Retreive a list of workets, iViews, pages from Roles
    but i am facing some issue.
    if the role has workset in it,its not able to read the iviews or pages from it.
    its retreiving null.
    please may i get some solution or some working code regarding this.
    Regards,
    Savitha

    Hi all,
    I have been working on retreiving the workset,folders,iview,pages from a role.
    i am refering to the code given in the forum thread
    Retreive a list of workets, iViews, pages from Roles
    but i am facing some issue.
    if the role has workset in it,its not able to read the iviews or pages from it.
    its retreiving null.
    please may i get some solution or some working code regarding this.
    Regards,
    Savitha

  • Trigger Navigation an iView/Page from Portal component

    All,
    I am writing AbstractPortalComponent and after performing some logic, I have to forward the control to a iView/Page. Please let me know how I can trigger navigation to a iView/Page from within AbstractPortalComponent.
    Thanks,
    Prasad

    Hi Reddy,
    You can use EPCF Navigation API in response.write.
    response.write("<html>");
    response.write("<script language='javascript'>");
    response.write("EPCM.doNavigate('ROLES://<pcd location of the iview or page>');");
    response.write("</script>");
    response.write("</html>");
    Or you can use request.redirect(url) for this depending on your requirement. For request.redirect check this link.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/b7/60b54066ea8531e10000000a1550b0/frameset.htm
    Regards,
    Vaishali

  • I want clear definitions of iviews, pages, worksets & roles

    hi
    Edited by: giridhar  rao on Sep 23, 2008 7:56 AM

    Hi,
    Iviews are Content Providers ( It provides the framework.They are basic building blks for Portal)
    ROLE ( group of worksets )
    WORKSET ( group of Pages )
    PAGES ( group of Iview )
    Refer the below thread.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/cb8bb4c4370cd5e10000000a1553f7/frameset.htm.
    For More Info :
    iViwes:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/df/bedca2076511d7b84500047582c9f7/content.htm
    Pages:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ac/c29d3f53055a7be10000000a11405a/content.htm
    Worksets and Roles:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/4f/bceaffeb8c114ebef8255b63079c7c/content.htm
    Regards,
    Srinivas.

  • Retrieving iViews ,Pages and Worksets from roles

    Hi All,
    I am using the code given here..
    Retreive a list of workets, iViews, pages from Roles
    but while getting pcdFactory its giving class cast exception.
    Could anyone tell me what might be the mistake?
    Regards,
    Karthick

    Hi Karthick,
    I think I answered on another post, but here it is again:
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
    env.put(Constants.REQUESTED_ASPECT, IPcdAttribute.PERSISTENCY_ASPECT);
    env.put(Context.SECURITY_PRINCIPAL, request.getUser());
    env.put(IPcdContext.PCD_PERSONALIZATION_PRINCIPAL, request.getUser());
    InitialContext iCtx = null;
    String roleID = "pcd:portal_content/DanielContent/DanRole";
    try{
        iCtx = new InitialContext(env);
        IPcdContext attrSet = (IPcdContext) iCtx.lookup(roleID);
        response.write(attrSet.getAttributes("").get("com.sap.portal.pcd.gl.CreatedAt").get() +"--PP<BR>");
    Hope it helps.
    Daniel

  • List of all iviews assigned to a user

    Hi all,
    i need to display list of all iviews of a particular user in a dynpage.
    as we cant follow the typical role based approach, i need to list the links of all iviews which is user is allowed to access..
    help me with api's to do this.

    Hi,
       Check this link.
    Retreive a list of workets, iViews, pages from Roles
    Using this, you can get the assigned roles to that user. Do some more coding like this from the role list to get the iViews. For getting whole list of iViews, check this link.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6112ecb7-0a01-0010-ef90-941c70c9e401
    May be you can try to compare from the whole list of iViews with the list which you get from the first link and then add those alone.
    Hope that will help you start the process.
    Regards,
    Harini S

  • Calling  an existing iView/page

    HI
    How to call an existing iView/page from a jsp page.
    Thanks
    Shashank

    Hi,
    You can call the iview directly with an URL..URL format looks like below.
    http://server:port/irj/servlet/prt/portal/prtroot/<PCD_LOCATION_URL>
    Replace the server with your host name and port with you port number and copy the PCD URL of an iview after prtroot in the above URL and change the PCD URL as mentioned below
    replace ':' with '!3a'
    replace '/' with '!2f'
    Hope this helps you..
    Jojo

  • Unable to create default IVIEW & Pages

    Hello,
    On one of the issue, SAP asked us to upgrade the portal component from EPPSERV 03 to EPPSERV 04(EPPSERV04P_2-10005915.SCA).
    After the upgrade I am not able to create any (default)iviews as well as pages. I am getting the following error
    005056BA329900770000024600000A1C00047A5063299BD0#1260385586313#com.sap.portal.prt.runtime#sap.com/irj#com.sap.portal.prt.runtime#Administrator#23436##n/a##d0c49c40e4f511de851e005056ba3299#SAPEngine_Application_Thread[impl:3]_7##0#0#Error##Java###11:06_09/12/09_0036_9340750
    [EXCEPTION]
    #1#java.lang.NoSuchMethodError: com.sapportals.portal.pcd.gl.PcdSearchControls.addExplicitAttributeCheck(Lcom/sapportals/portal/pcd/gl/IPcdAttribute;)V
         at com.sap.portal.pcm.iviewserver.cache.TemplatesCacheSrv.getPCDCatalog(TemplatesCacheSrv.java:184)
    Portal is on EHP1 SPO3.
    Thanks
    Edited by: Imran Mohammed on Dec 9, 2009 9:18 PM

    Hi Anil,
    I have cleared the Navigation cache & PCD cache as well..even restarted the server..but no help.
    Do you have any idea..whats going on
    Everytime when I try to create IVIEW/PAGE from template I get the following error
    java.lang.NoSuchMethodError: com.sapportals.portal.pcd.gl.PcdSearchControls.addExplicitAttributeCheck(Lcom/sapportals/portal/pcd/gl/IPcdAttribute;)V
        at com.sap.portal.pcm.iviewserver.cache.TemplatesCacheSrv.getPCDCatalog(TemplatesCacheSrv.java:184)
        at com.sap.portal.pcm.iviewserver.cache.TemplatesCacheSrv.refresh(TemplatesCacheSrv.java:589)
        at com.sap.newpage.pagewizardpanes.PageTemplateSelection.initTemplates(PageTemplateSelection.java:229)
        at com.sap.newpage.pagewizardpanes.PageTemplateSelection.wdDoModifyView(PageTemplateSelection.java:172)
        at com.sap.newpage.pagewizardpanes.wdp.InternalPageTemplateSelection.wdDoModifyView(InternalPageTemplateSelection.java:305)
        ... 50 more
    java.lang.NoSuchMethodError: com.sapportals.portal.pcd.gl.PcdSearchControls.addExplicitAttributeCheck(Lcom/sapportals/portal/pcd/gl/IPcdAttribute;)V
         at com.sap.portal.pcm.iviewserver.cache.TemplatesCacheSrv.getPCDCatalog(TemplatesCacheSrv.java:184)
         at com.sap.portal.pcm.iviewserver.cache.TemplatesCacheSrv.refresh(TemplatesCacheSrv.java:589)
         at com.sap.newpage.pagewizardpanes.PageTemplateSelection.initTemplates(PageTemplateSelection.java:229)
         at com.sap.newpage.pagewizardpanes.PageTemplateSelection.wdDoModifyView(PageTemplateSelection.java:172)
         at com.sap.newpage.pagewizardpanes.wdp.InternalPageTemplateSelection.wdDoModifyView(InternalPageTemplateSelection.java:305)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doModifyView(DelegatingView.java:78)
         at com.sap.tc.webdynpro.progmodel.view.View.modifyView(View.java:337)
    Thanks

  • How to call a standard page from a custom BSP-iView by URL

    Dear readers,
    I have to implement a scenario as described in the guide "Administration of the Business Package for SAP CRM 4.0", chapter "Object Links in the Portal" scenario 1 and/or 2 (page 404).
    In my case, a custom iView-BSP lists certain business partners in a tree view as hyperlinks. Which URL do I have to use for these hyperlinks to call the "Accounts" page (within role Account Management (com.sap.pct.crm.AccountManager)) with the selected business partner.
    The guide informs that there exists among others a table CRMC_PRT_ROLE_MO where I can find the ID Page/Servie URL for each Role/CRM Object type/CRM Method.
    My question is if I can use this URL fragment within the URL I have to build, and if yes, how must I construct the full URL to call the account page? If now, which URL must I use to call the account page?
    thank you
    Andreas

    Hi Niladri,
    My requirement was calling the OAF page from standard form (menu), below are the steps that I followed,
    1) Get the OAF page function name
    2) Personalize the form, by calling the OAF page function
    a) Function Code: Give the OAF function code
    b) Parameter: Here pass the parameters
    example: ='contractLineId='||:OKS_LINES.ID
    Note: If you are calling from a custom form you can also try using fnd_function.execute to call the OAF page
    Thanks,
    Bharat

  • Using selected items from drop-down list in rest of page

    Hi,
    I hope I'm able to describe clearly what's the problem.
    So I'm implementing a form for the moment. It contains a drop-down list. The user has to select one item from it and as a result another drop-down list on the same page needs to be filled with a couple of options. I wanna do this without refreshing the page, cos else I have to retrieve all the values from boxes that were allready filled in. Is it possible?
    Greetings,
    Raf

    This cn be done with javascript. But you need to cache the data on first load of your jsp.
    regards

  • I don't want to have to click the allow button every 3 seconds uploading video, how do I disable the "firefox prevented the page from reloading" when I've already put the site on my exceptions list?

    I begin uploading video to Facebook and a small window opens to show the progress bar but, the video stops uploading about every 5% when a notification comes from the top bar stating: "Firefox prevented the page from reloading" with an Allow button on the right. Regardless of clicking the allow button and putting Facebook in every exception list Firefox options seems to have or even turning pop up blockers off, that dam button keeps coming! How do I prevent or disable this?
    I am running windows XP media center edition SP2, and have Firefox v3.6.11

    You're welcome

  • How do I stop pages from automatically continuing to number or letter lists

    I am trying to create a document in which i am answering questions. It is supposed to be in this type of format:
    I. Residents
    #1 Household
    a) how many people live in the home
    b)
    c)
    d)
    and so forth. I got partway through and now pages is automatically adding the lettering everytime I press the return key. I cannot figure out to stop this from happening, I cannot delete the lettering/numbering to continue typing. Please help. I just want to manually put in the numbers or letters as I need them, not as the program thinks I want them.

    Hi Jenn,
    Pages Preferences > Auto Correction > untick Automatically detect lists.
    To remove numbers from what you already have, select the text then
    Inspector > Text > List > No Bullets
    Regards,
    Ian.

  • Display SharePoint:RichTextField value as is from list item into application page

    Hello,
    I would like to show value entered in Rich Text Field in list on one application page.
    I am displaying it like below as I would like to use the default functionality provided by SharePoint and this is an application page replacing the default page for list form.
    <SharePoint:RichTextField ID="RTTaskDescription" runat="server"  FieldName="Task Description" ControlMode="Display"/>
    But when it renders the output as below with DIV and STRONG as description word is bold in list item.
    <DIV>THis is task <STRONG>description</STRONG>.</DIV>
    Any way to handle this to show as it is in list item with proper HTML from server side?

    Hi,
    Did you try this
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/2efb5464-e4d1-4a81-bb96-ebcde5aeffc8/want-to-remove-divdiv-tag-while-displaying-list-columntypemultiline-text?forum=sharepointdevelopmentlegacy

  • Is there a way to have firefox save web pages from a batch list of urls

    Is there a plugin for firefox to load urls from a list and save the pages including images to file

    I'm not aware of such an add-on, but it might exist. There also might be a Greasemonkey userscript that will load the pages and fire the save.
    This thread discusses way to save pages once you have them loaded: [https://support.mozilla.org/en-US/questions/923234 How to save a website using firefox. | Firefox Support Forum | Firefox Help].

  • How do you automatically create a page from an entry in another list?

    I have a custom list with lots of entries and I would like to set it up so that by adding a new entry to my list a new site page is automatically created for that entry. I thought I could configure this by using lookup columns by adding these colums to the
    site pages list which are linked to the columns in my custom list. That way the site pages list will be populated as I add more entries to my custom list. However I tried this and none of my entries from my custom list were displayed.So how would I go about
    doing this? It would be great if a new page was automatically created from a template as well.
    Thanks!

    Hi,
    Please check URL
    http://sharepointryan.com/2013/09/10/create-a-sharepoint-site-spweb-using-rest-in-spd-2013-workflow/ it might help you !!
    Regards
    PT

Maybe you are looking for

  • Paragraph Format / Character Format for Variable address in SAPSCRIPT

    Dear All,    I am trying to print variable address for ship-to-party. But the address is variable address for different vendors. The contents like /:  ADDRESS PARAGRAPH AS /:  TITLE    &LFA1-ANRED& /:  NAME     &LFA1-NAME1&, &LFA1-NAME2&, &LFA1-NAME3

  • Condition Record for picking Output List

    Dear All Kindly let me know where do we maintain condition record for Picking Output list. Where do we define a new Output Type for Picking List Regards Srihari

  • Address book won't re-import .abbu file

    Searching in my address book didn't work anymore so I exported the whole address book as an .abbu file and deleted all entries. Now when I try to import that file, it looks for busy for a few minutes and then ends up having no entries. I tried discon

  • Push button in a table

    Hi, I have an internal table and showing this itab with dialog programing. I have inserted a new column in table, I need that when client has pressed such as 5th line I want to get 5th line's information. I have created a field which's length is one

  • Copying Folders Error 36

    My iMac won't let me copy any folder to a FAT USB drive saying "files cannot be located error 36" however I can still copy the content of each folder to the drive fine. This is making a simple 3GB copy of my work take ages as I need to copy the conte