Controlling role visibility through code

Hi All,
I need to be able to hide worksets and roles depending upon the user that logs in. I have managed to control iviews and pages using the following code
Hashtable env = new Hashtable();
env.put(
       Context.INITIAL_CONTEXT_FACTORY,
       IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
env.put(Context.SECURITY_PRINCIPAL, request.getUser());
env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
InitialContext iCtx = null;
try {
iCtx = new InitialContext(env);
     IiView result = null;
     Object currentObject  =  iCtx.lookup(iViewID);
     if (currentObject instanceof IiView) {
                           result = (IiView)currentObject;
     }else{
     result.putAttribute("com.sap.portal.navigation.Invisible",invisibleValue);
     result.save();
} catch (UnsupportedOperationException e) {
                                                  e.printStackTrace();
} catch (NamingException e) {
     e.printStackTrace();
} catch (ValidationException e) {
     e.printStackTrace();
} catch (IOException e) {
     e.printStackTrace();
After looking around some more, i thought there must be something similar for worksets and roles as well.
I found the use of IRoleService and IRoleDescriptor. But its only given how to create new roles using these. Can someone help me out on how to access existing roles so that I can set the property dynamically  for them?

Hi Malita,
The approach you have followed is not scalable. you should use PCD filter.
Refer to
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/5021a57d-0601-0010-6097-ec94a09c626d?QuickLink=index&overridelayout=true
Please note that you should use PCD filter only when there is no other option. Most of the times you can achieve the same result by tweaking your design.
Also refer to
Be Careful When Combining Navigation Cache, PCD Filter
to understand when you shouldn't be using PCD filter.
Let the community  know your exact requirement and the community should be able to suggest the best approach.
Thanks
Prashant

Similar Messages

  • Assign role request through code not going to Operational level

    Hi All
    We are trying to assign roles through code using the OIM API's as suggested in the documentation
    "http://docs.oracle.com/cd/E27559_01/doc.1112/e28183/oim_up.htm#autoId40".
    We have 2 Approval policies one is at Request Level (i.e. Auto Approval) and the other is Operational level(Scope=ALL Scope) with workflow, So once the request is getting raised with the code successfully it is getting completed. The expected behavior is that it should go to the approval workflow attached at operational level.
    When we tried to attach a workflow at the request level, the request is going through Approval workflow attached at request level and once we approve at request level it is getting completed and not going to operational level.
    But we will have Request level as auto approved and Operational level with two level of Workflow.
    Thanks in Advance

    Check whether you have configured Request Type in your approval policy properly for operational level approval. In the Rule Components section check whether you have configured everything correctly. Also dont raise the request from system admin login as it will be treated as a direct provisioning request and your approval policies will not be invoked. Login through an end-user and test it

  • Generating pdfs with invisible sections made visible through code

    I have a survey with several question that are either visible or hidden based on the user's selection from a Yes/No radio button group.  The user can then either submit the survey by e-mail or print the survey.  If the user prints the survey before submission, all of the invisible portions that the user's input has rendered visible are included in the printed copy; however, when the pdf is generated to be attached to the e-mail submission or saved using the Save As option, the elements that were made visible by code are not included in the pdf.  The following is the code being used in the Yes radio button:
    Comp4WhenImplementText.presence = "invisible";
    Comp4WhenImplement.presence = "invisible";
    Comp4MajorFactorText.presence = "invisible";
    Comp4WhenImplement.Comp4When03 = 0;
    Comp4WhenImplement.Comp4WhenNever = 0;
    if (Comp4No.selectedIndex != -1 ||
      Page3.Comp1.Comp1No.selectedIndex != -1 ||
      Page4.Comp2.Comp2No.selectedIndex != -1)
    CorrectiveAction.presence = "visible";
    else
    CorrectiveAction.presence = "invisible";
    The code in the No radio button is as follows:
    Comp4WhenImplementText.presence = "visible"
    Comp4When.presence = "visible"
    CorrectiveAction.presence = "visible"
    The code in the e-mail submit button:
                   form1.#subform[12].Button2::click - (JavaScript, client)
                   if (CorrectiveAction.presence == "visible")
                      if ((CorrectiveAction.rawValue == null) || (CorrectiveAction.rawValue == ""))
                   else
                   Button1.execEvent("click");
                   else
                   Button1.execEvent("click");
    Button1 is invisible and layered under the visible e-mail submit button.  It actually submits the pdf by e-mail.  The visible button performs a test and displays a message to the user if the user's survey answers fail.  I have also tried "hidden" in all of the areas that are listed as "invisible".
    What should be added or changed so that the invisible elements of the survey that are rendered visible by code can be seen in the pdf of the survey.  Any assistance would be greatly appreciated.

    There is a setting that indicates to save the changes amde via code to the form when saved. In Designer goto the File/Form Properties/Defaults and ensure that the Radiobutton named Automatically under the Preserve Scripting changes to form when saved is set on.
    Paul

  • Control Characters visible in code view

    Not sure how I managed to turn on this "feature" but when I'm looking at any .cfc file in CFBuilder I see lightly grayed out controll characters (like \n for new line or >> for tab, or ..... for spaces). Not a really big deal, but damned annoying when you're staring at it for a while. Does anyone know how to turn this off?

    I'll share that I point out that and many other little hidden gems in a talk of that name, available online:
    http://carehart.org/presentations/#cfbgems
    I realize you wouldn't have thought to look there for the answer, but I'm saying that if folks using CFB were to check it out, they may learn lots of other little surprises (solutions/features) like that. Hope it helps someone.
    /charlie

  • Controlling Table Column visibility through Program

    Hi Experts
    We have custom WD Java applications developed in NW 7.0 which we have now migrated to NW 7.3.
    The visibility property of the columns are bound to the Context attributes. In the application, we are controlling the visibility of the Table columns by setting the values of context attributes.
    However, i could see that even though the visibility property is set as "NONE", by printing it on screen, those particular columns are visible.
    Am I missing something?? Do we need to take care of something or is any other property needs to be set??
    Thanks in advance..
    Regards,
    Deepak

    OK, starting at the lowest level is getting the column selected, since we need to select the correct column
    before selecting the first cell in the column to rename (a separate funciton?) and then the remaining cells
    in the column (another function)? Once these two functions are done, the rest would be like the example in the
    the Frame book, since then you would have a function select only the tables that have a certain name and then
    all the files in the book.
    #target framemaker
    // !! first, click on table
    var doc=app.ActiveDoc;
    //Get the table containing the insertion point
    var tbl=doc.SelectedTbl;
    //Get the first cell in the first row
    var cell=tbl.FirstRowInTbl.FirstCellInRow;
    var colNum=3;
    for (var i=1; i<colNum; i+=1){
        cell=cell.NextCellInRow;
    while (cell.ObjectValid()){
        var pgf=cell.FirstPgf;
        alert (pgf.Name);
        alert(cell);
        cell=cell.CellBelowInCol;// Move down to next cell

  • Changing the Updatable property of a View Object Attribute through code

    Hi,
    Is there a way to set the "Updatable" property of an attribute in a view object through code ?
    I checked the API docs for the AttributeDef class but there is no method to set this. there is a constant (UPDATEABLE_WHILE_NEW) which gives the current value.
    My requirements in short - I have a ADF editable Table. Based on a flag whether it is SET or NOT, i need to make a particular column such that the inputTextBox on this column must appear for only the new rows inserted into the table. For all the existing rows users should not be allowed to edit values on this column.
    I know this can be controlled with the UPDATABLE property on the attribute in the view object by setting the value as "WHILE  NEW".
    Now i need to control this through code at runtime.
    Please let me know on ow to do this.
    JDev version: 11.1.2.3
    Thanks.

    the method you are looking for is available in the AttributeDefImpl class which you can get from the EntityImpl like
    this.mDefinitionObject.getAttributeDefImpl("YOUR_ATTRIBUTE_NAME").setUpdateableFlag(AttributeDef.UPDATEABLE_WHILE_NEW);
    Timo

  • How to give  acces  to app to use  the  images in device through code

    Hi,
    I am writting an Iphone app, in some part of my application there is a facility  to the users  to  upload their files , but the device is asking to give permission to the app to access files,   i have to do that  manually , my question   is there any way to acheive that through code,  In  am  using Xcode to  create my app
    Thanks.

    Hi Kasturi,
    > not accepting the points
    It worked on this and on one other thread, but this is still open: How to upload the image
    > want upload the images from the client side machine
    > to KM
    In the thread I just referred to, I already provided information about the HTMLB upload control. With this at hand, you'll get the file from the client to the server.
    At server side, get an ICollection instance where you want to store the file and create the corresponding resource. See https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/javadocs/nw04/sp12/knowledge management/com/sapportals/wcm/repository/icollection.html#createresource(java.lang.String,%20com.sapportals.wcm.repository.IPropertyMap,%20com.sapportals.wcm.util.content.IContent)
    Hope it helps
    Detlev

  • Coded UI : Window '' is blocking the control 2015. Please move the window '' or make the control 2015 visible and retry the action. Additional Details:

    Hi ,
    I'm trying to do a test automation using codedUI. This is a Windows application based on WPF.
    I recorded the events and when playback I get a error.
    There are two datetime pickers in the same form and when doing a playback one is picking up the date correctly where as the other datetimepicker is throwing the error as below.
    Window '' is blocking the control 2015. Please move the window '' or make the control 2015 visible and retry the action. I tried even manually selecting some offset points but still the calendarfield shows empty.
    Thanks,
    Jayashree

    Hi Jayashree,
    Thank you for posting in the MSDN forum.
    >> Window '' is blocking the control 2015. Please move the window '' or make the control 2015 visible and retry the action.
    Please debug it with steps in this blog:
    http://blogs.msdn.com/b/visualstudioalm/archive/2012/03/04/handling-playback-failures-in-coded-ui-test-due-to-stale-ui-controls.aspx
    Please make sure that the target control is well truly visible on the screen, and then troubleshoot action you need to take is to check if the search has actually hit the correct target element. You can make use
    of the
    DrawHighlight method in your test code to validate this.
    Best Regards,
    Jack 
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • User Management - Configuring through code

    Create a session variable in the datasyn project. In a filter we will set a sesssion variable, the value of the session variable will be an array of strings. Each element of the array will contain the groups associated to the user. In Portal admin tool we have to configure to do entitlements from this session variable.
    Does anyone have any idea how to configure the entitlements in portal admin console thorugh a session variable?
    Please let me know if this approach of configuring user management through code is feasible?
    Thanks,
    Sid
    Edited by: user10869789 on Jul 23, 2009 10:54 AM

    Just in case you missed it , if the condition is always based on the user's groups then you need not use session property set , you can directly use 'Add Groups to Role' when you are editing the visitor entitlement
    As a rule i would tend to avoid putting things in the session unless there was no other way. (in your case , everytime the user's group changes the session must be updated , it also means that changing the groups through any external means e.g. directly updating say the user ldap would not reflect in the users current session -- unless you wrote more code)
    The benefit of using the session would be that this need not be directly mapped to a group , it can be anything you want.
    regards
    deepak

  • I want to make a slideshow to view on my television with image's duration ranging from seconds to an hour or more and I want to use my iPhone or iPad mini to control the television through my Apple tv.  I've been unable to locate an app that will do this.

    I want to make a slideshow to view on my television with image's duration ranging from seconds to an hour or more and I want to use my iPhone or iPad mini to control the television through my Apple tv.
    I've been unable to locate an app that will do this.  The Photos app that comes with the phone or iPad has extremely limited duration controls.  PhotoStream seems to load everything from my phone or iPad not allowing me to just load up a set group of images.
    iPhoto for iPad is getting some terrible recent reviews.  I tried a couple other free apps but they don't use Airplay.
    I can do something like this with iPhoto and my MB Air, but it's kind of ugly to have the computer open in order to connect by Airplay to my Apple TV.  I've thought the iPad or iPhone would be a lower profile controller.
    Am I out of luck?

    Thanks for your help.  Since I'm uninterested in loading all my photos (the only option) into photostream, I won't be able to use the settings in ATV.  I guess I'm just stuck with using iPhoto on my MB Air.  Thanks again.
    paul

  • Exception while accessing web service through code

    I have a web service developed using AXIS deployed on Weblogic 8.1
    Another web application cotaining GUI deployed on Weblogic 10 tries to access this web service through code.
    This piece of code to invoke the web service is written in Action Class present inside web application. (Struts is used in GUI based web app)
    When the code tries to invoke web service I am getting following error.
    (401)Unauthorized xxx
         at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:630)
         at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:128)
         at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
         at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
         at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
         at org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)
         at org.apache.axis.client.Call.invokeEngine(Call.java:2564)
         at org.apache.axis.client.Call.invoke(Call.java:2553)
         at org.apache.axis.client.Call.invoke(Call.java:1753)
         at com.ebv.app.web.action.UCS77_1ProcessOfficialChangeSaveDetailsAction.invokeAx(UCS77_1ProcessOfficialChangeSaveDetailsAction.java:243)
         at com.ebv.app.web.action.UCS77_1ProcessOfficialChangeSaveDetailsAction.callUCS77_1ProcessOfficialChangeWebService(UCS77_1ProcessOfficialChangeSaveDetailsAction.java:173)
         at com.ebv.app.web.action.UCS77_1ProcessOfficialChangeSaveDetailsAction.processAction(UCS77_1ProcessOfficialChangeSaveDetailsAction.java:133)
         at com.ebv.framework.web.action.EBVAction.execute(EBVAction.java:106)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    The web service URL is as follows:
    http://10.140.96.5:7808/services/ucs77_1/ProcessOfficialChangeSave77_1-v0001.soap
    However
    When I try to hit the webservice URL directly on browser login window appears where same username/password I provide which are passed in code to invoke the web service. I get the success page indicating that web service is invoked on hitting enter.
    The method used in UCS77_1ProcessOfficialChangeSaveDetailsAction.java to invoke web service is as follows:
    public String invokeAx
                   String xmlMessage,
                   String webServiceURL,
                   String webServiceOperation,
                   String username,
                   String password)
              String xmlResponse = null;
              Call webServiceCall = null;
              InputStream input = new ByteArrayInputStream(xmlMessage.getBytes());
              Service service = new Service();
              try
                   webServiceCall = (Call) service.createCall();
                   SOAPEnvelope env = new SOAPEnvelope(input);
                   SOAPEnvelope resEnv = null;
                   webServiceCall.setTargetEndpointAddress(new URL(webServiceURL));
                   webServiceCall.setOperationName(new QName(webServiceOperation));
                   webServiceCall.setUsername(username);
                   webServiceCall.setPassword(password);               
                   try
                        resEnv = webServiceCall.invoke(env);
                   catch (AxisFault e)
                        e.printStackTrace();
                        Message responseMessage = webServiceCall.getResponseMessage();
                        SOAPEnvelope soapXml = (SOAPEnvelope) responseMessage.getSOAPEnvelope();
                        xmlResponse = new String(soapXml.toString().getBytes(AppConstants.UTF8),AppConstants.UTF8);     
                   if (xmlResponse == null)
                        xmlResponse = resEnv.toString();
              catch (Exception e1)
                   e1.printStackTrace();
              return xmlResponse;
    Both the weblogic server reside on two different AIX machines.
    Can anybody tell what's the problem while invoking web service through code?

    time to look into the gateway logs as stated by the fault ..
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode xmlns:p="http://schemas.oblix.com/ws/2003/08/Faults">c</faultcode><faultstring>Step execution failed with an exception</faultstring><detail></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
    looks like the cipher step might have failed

  • Creation of role using T-code PFCG in R/3

    Hi Experts,
    I have created a Role using PFCG inorder to give acess only to three T-codes(PZ09. PZ80,PZ88).
    so i have created a role intially using PFCG and incorporated PZ09 tcode in it and assigend the Role to users in R/3. it is displaying the TCode(PZ09) in Portal.
    Now again i have added PZ80 & PZ88 to the same Role in R/3, but now i am getting an error:
    Infotype 0000 does not exist.
    but whereas when i assign SAP_ALL they(PZ88 & PZ 80) are working fine.
    Is they anything i can do so that i can avoid assigning SAP_ALL Profile to the users and eliminate the Error "Infotype 0000 does not exist.
    Thanks Inadvance,
    Regards,
    Siva

    Hi,
    Thanks for your reply,
    Creation of role using T-code PFCG in R/3
    The above link has solved my issue, Thank you!
    Regards,
    Siva

  • Creating Business Partner Through Code

    Hi Everyone
    I just wanted to know if any of you knew a way to create a business partner through code.
    If there is a way or a sample that anyone can provide that would greatly
    apreciated.
    What would mandatory fields be? I know CardCode would be one mandatory field but what else would be essential?

    Hi Sebastiano,
    If you only need to read the BP data from the 'source' company then you shouldn't need to log in to it. The RecordSet object should be capable of sending a SQL query that references the other database.
    For example:
    string sSQL = "select * from " + sSourceDatabase +"..OCRD where CardCode = '" + sMyBPCode +"'"
    where sSourceDatabase is the Database ID for the source company and sMyBPCode is the BP you wish to copy.
    Using this you should only need to log in to the company where the BP needs to be created. So the whole process should be something like this:
    1) Connect to second company
    2) Run the query to collect the BP data from the first company
    3) Create an instance of the BP object and use the recordset object to assign the properties
    4) Add the BP
    Hope this makes sense
    Owen
    P.S. The other option is to use XML. See this post:
    Copy items between databases

  • I am looking to control a 4-way hydraulic solenoid valve. Do I need a PID control toolset, or can i control the system through my 16E4 daq card and scxi chasis

    I am looking to control a 4-way hydraulic solenoid valve. Do I need a PID control toolset, or can i control the system through my 16E4 daq card and scxi chasis

    I think you're asking 2 different questions.
    The PID control toolset is for using PID loops for control; it's just software.
    The DAQ card and scxi chassis are hardware. If you have the appropriate signal conditioning cards in your chassis to control/monitor your solenoid valve, then you can run a PID loop.
    I believe the simple answer is: the PID control toolset is the best way to do control, but there are simple PID VI's (even on this website) that you can download and use for simple control.
    Mark

  • How to create a Xfdf doc. in Acrobat Pro 10 through code?

    Hi All..!!!
    I wanted to know whether there is a way to create an XPdf document in Acrobat Pro 10. I know that we can create a pdf document through code using the SDK.. I wanted to know whether the same can be done for XPdf documents..
    Thanks!! 

    Writing an XFDF is not that difficult; all you need is a tool allowing you to assemble text strings.
    The preferred way to get a sample on how the XFDF should look like is to export one from the form concerned, and to repeat it using your code. In this case, the document knows best how the XFDF should look like.
    Hope this can help.
    Max Wyss.

Maybe you are looking for

  • RFC enabled FM to fetch partner details of vendor from ECC system

    Hi All, I am working on an enhancement in SRM system.the requirement is as follows. 1.In the current SRM application, the invoicing party partner function does not exist.Because of this, the invoicing party cannot be populated on any external purchas

  • Sending contacts from iphone via blue tooth

    Is it possible to do this? Please help?

  • Date to Month and Year

    Hi Guru's We have a requirement of taking the input in date/month/year format in the DSO and the output to be displayed in the report is in month/year in the report. We dont want to do any changes/modification in the DSO level. Any ideas on how to do

  • Online account not showing My Products

    This may be the wrong forum, maybe someone can point me in the right direction if it is. When I log into My BT and go to My Account, under My Products it says "No Phone on this account" and " No Broadband on this account". I have had both for years.

  • How use Group By Rollup in BIP ?

    Hy everybody , I create a dataset with this query : SELECT  cntr.country_region "Region" , cntr.country_name  "Pay ", Round(AVG(s.quantity_sold * s.amount_sold ),2) "Moyenne Des Ventes" FROM customers c inner join sales s on c.cust_id = s.cust_id inn