Filter data in function of the logged user

Hi,
I don't and I can't use ADF security for my current project but I need an authentication system.
So I created a simple managed bean (session scope) with current user information (username, roles, ...).
The problem is that displayed data must be filtered in function of the user (and his roles).
How can I do to access my user information in my application module?
I think that the easiest solution would be to access directly my managed bean in my application module but I don't know how to do that.
As I said I can't use ADF security so I don't have access to getUserData() & getUserRoles()...
Do you have any idea?
Thanks in advance!

There is one possibility of which I can think of.
1 Create a package in your database: e.g.
create or replace package PCK_LOGIN
as
c_user_id varchar2(50);
procedure set_user_id(pi_user_id in varchar2(50)
as
begin
c_user_id := pi_user_id;
end;
function get_user_id
as
begin
return c_user_id;
end;
end;Then create a method in your application module to call set_user_id.
After you have the user id in your bean you need to call this method.
Now the user id is known in the database (this is session dependent!)
and you can user M_LOGIN.get_user_id in your views and view objects.
To access the application module in your bean you can use the code
    private AppModule getAppModule(String dataControl) {
        // 1. Access the FacesContext
        FacesContext fc = FacesContext.getCurrentInstance();
        // 2. Create value binding for the #{data} EL expression
        ValueBinding vb = fc.getApplication().createValueBinding("#{data}");
        // 3. Evaluate the value binding, casting the result to BindingContext
        BindingContext bc = (BindingContext)vb.getValue(fc);
        // 4. Find the data control by name from the binding context
        DCDataControl dc = bc.findDataControl(dataControl);
        // 5. Access the application module data provider
        ApplicationModule am = (ApplicationModule)dc.getDataProvider();
        // 6. Cast the ApplicationModule to its client interface
        AppModule appMod = (AppModule)am;
        return appMod;
    }You can also do a variation without the database. You can also just set a private variable in your application module in the same way as described above.

Similar Messages

  • Getting the logged user type

    hi all,
    how do we get usertype to check whether the logged user is a customer type or administrator type in istore.
    Please help me out.
    Thanks
    Mark

    You can use below built in methods to identify the user type.
    1) RequestCtx.userIsStoreAdmin()
    2) RequestCtx.userIsInternalUser()
    3) RequestCtx.userIsAnonymous()
    4) RequestCtx.userIsSalesRep()
    5) RequestCtx.userIsBusinessCustomer()
    6) RequestCtx.userIsUnapprovedBusinessCustomer()
    7) RequestCtx.userIsPartner()
    8) RequestCtx.userIsIndividualCustomer()
    Hope this will be helpful.

  • How to use user id of the logged user (in Application) in the Valueset

    Hi All,
    I want to Create a Table Value Set.
    i want to Filter the values in value set based on the User id by which user has logged in Application.
    How to get user id and how it can be used in Table Value set Query.
    Please guide me...
    Waiting 4 ur response.
    Thanks
    Sheetal

    Hi Sheetal,
    You can call the function fnd_global.user_id to get the current user identifier of the logged in user.
    Regards,
    J.
    SELECT fnd_global.user_id
    FROM   dual

  • Date Manipulation Depending on the various user date settings

    hi,
    I have a query.
    In scripts, user date format setting is YYYY.MM.DD, values stored the table MHND are also in the format YYYY.MM.DD.
    However when i pass the date values from MHND from form to subroutine pool the dates are available in the format DD.MM.YYYY in the subpool.
    I want to calculate the diffenece between two dates. I have checked the function modules to calculate the differece betweent 2 dates those acccepts dates with type YYYYMMDD.
    However i tried to bring my dates in from YYYY.MM.DD into YYYYMMDD format by using CONVERT_DATE_INTERNAL function module... That is not working as the user date format is YYYY.MM.DD and the dates are coming in subpool in DD.MM.YYYY format....
    Please suggest me the approach the relavant function modules.... so as to manipulate the dates based on the user date settings.
    Looking forward for your replies. Thanks in advance.
    Regards,
    Anuja.

    hi anuja,
    Try using the following formatting  script symbol in your form routine
    For example, you are passing the date into the subroutine then put K after the date field like below.
    &date(K)& .
    or
    use SET DATE MASK : YYYY:MM:DD
    Thanks,
    Vamshi

  • Unable to debug the Data Template Error in the Log file

    Hi,
    I am unable to debug the log file error message Please can anybody explain me in detail where the error lies and how to solve the error.The log file shows the following message.
    XDO Data Engine ver 1.0
    Resp: 50554
    Org ID : 204
    Request ID: 2865643
    All Parameters: USER_ID=1318:REPORT_TYPE=Report Only:P_SET_OF_BOOKS_ID=1:TRNS_STATUS=Posted:P_APPROVED=Not Approved:PERIOD=Sep-05
    Data Template Code: ILDVAPDN
    Data Template Application Short Name: CLE
    Debug Flag: Y
    {TRNS_STATUS=Posted, REPORT_TYPE=Report Only, PERIOD=Sep-05, USER_ID=1318, P_SET_OF_BOOKS_ID=1, P_APPROVED=Not Approved}
    Calling XDO Data Engine...
    java.lang.NullPointerException
         at oracle.apps.xdo.dataengine.DataTemplateParser.getObjectVlaue(DataTemplateParser.java:1424)
         at oracle.apps.xdo.dataengine.DataTemplateParser.replaceSubstituteVariables(DataTemplateParser.java:1226)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeData(XMLPGEN.java:398)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(XMLPGEN.java:281)
         at oracle.apps.xdo.dataengine.XMLPGEN.processData(XMLPGEN.java:251)
         at oracle.apps.xdo.dataengine.XMLPGEN.processXML(XMLPGEN.java:192)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(XMLPGEN.java:222)
         at oracle.apps.xdo.dataengine.DataProcessor.processData(DataProcessor.java:334)
         at oracle.apps.xdo.oa.util.DataTemplate.processData(DataTemplate.java:236)
         at oracle.apps.xdo.oa.cp.JCP4XDODataEngine.runProgram(JCP4XDODataEngine.java:272)
         at oracle.apps.fnd.cp.request.Run.main(Run.java:148)
    Start of log messages from FND_FILE
    Start of After parameter Report Trigger Execution..
    Gl Set of Books.....P
    Organization NameVision Operations
    Entering TRNS STATUS POSTED****** 648Posted
    end of the trns status..687 Posted
    currency_code 20USD
    P_PRECISION 272
    precision 332
    GL NAME 40Vision Operations (USA)
    Executing the procedure get format ..
    ExecutED the procedure get format and the Result..
    End of Before Report Execution..
    End of log messages from FND_FILE
    Executing request completion options...
    ------------- 1) PUBLISH -------------
    Beginning post-processing of request 2865643 on node AP615CMR at 28-SEP-2006 07:58:26.
    Post-processing of request 2865643 failed at 28-SEP-2006 07:58:38 with the error message:
    One or more post-processing actions failed. Consult the OPP service log for details.
    Finished executing request completion options.
    Concurrent request completed
    Current system time is 28-SEP-2006 07:58:38
    Thanks & Regards
    Suresh Singh

    Generally the DBAs are aware of the OPP service log. They can tell you the cause of the problem.
    Anyway, how did you resolve the issue?

  • How to execute a transaction with a different user from the logged user?

    Hello Experts!
    I'm trying to find out a solution about this scenario: our users need to release a Purchase Order (ME28) and/or a Service Entry Sheet (ML85) in SAP from a WEB based application through TIBCO, but the requirement is to execute this operation with the same SAP User name of the user (with his authorization) and not with the TIBCO user that is logged to SAP.
    Is there someone that could suggest me a real time solution and how to develop it? I really appreciate your contribute and I'm at your disposal for any further information.
    Thank you very much!
    Alessandro

    Hi Rob!
    Thank you for your help, but I can't apply this solution, because we need to execute the transaction with a specific user name and not a generic user, besides our user have different authorization, for example the user Mr. Rossi can release only his Purchase Order but not the PO of another user Mr. Bianchi. Moreover we need to see the PO released/modified from a specif user name. So this is our constraint.
    Bye Ale.

  • Is a Servlet-Filter which serializes requests in the same user session ok?

    The Servelt specification states that the Web-Application is itself responsible for synchronizing access to HttpSessions. It is from the serversite not possible to prevent multiple threads to access the same HttpSession (i.e. the user could always open a second window, retransmit a form etc). My assumption is that while this does not happen often it can happen and therefore I think each access to the HttpSession must be synchronized. For a further discussion see http://forum.java.sun.com/thread.jsp?forum=4&thread=169872 .
    Concurrent programming is generally complicated and errorprone. At least in developing JSPs it is inconvenient and easy to forget. My Web-App uses often HttpSession and it can be used in different not predefined places, so I had the idea to implement a ServletFilter which serializes threads which happen in the same session. This involves certainly some overhead. However for the advantages of easier code maintains and higher consistency I am ready to pay this overhead.
    My question is generally what you think of this approach and second whether the way I implemented the Filter works.
    The Filter actually generates for each Request an HttpServletRequestWrapper which intercepts calls to getSession and on call aquires a Lock so that other threads have to wait for the same Session. The lock is released when the doFilter method of the Filter returns. So threads run concurrently until the first access to the Session and from there they are serialized until the end of the Request.
    For the details I will give the code for the Filter and the Wrapper (that?s all the code needed except the ReentrantLock which is Doug Lea?s implementation http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html )
    the Filter
    public class SessionThreadFilter implements Filter
      public static final String MUTEXT_IN_SESSION_KEY = "org.jaul.filter.SessionThreadFilter.MUTEX";
      //constructor, init, destroy methods do nothing
      public void doFilter(ServletRequest reqIn,ServletResponse res,FilterChain filterChain)
        throws IOException, ServletException
        //if req not instanceof of HttpRequest don't do anything
        if (!(reqIn instanceof HttpServletRequest))
          filterChain.doFilter(reqIn, res);
        } else
          HttpServletRequest req = (HttpServletRequest) reqIn;
          //We use a HttpRequestWrapper each time a user accesses
          //through this
          //Wrapper a Session is Lock is aquired. The filter method returns
          //the lock if it exists is released
          //each thread needs it's own wrapper so the wrapper itself
          //doesn't have to be synchronized
          SessionThreadRequestWrapper wrapper = new SessionThreadRequestWrapper(req);
          try{
            filterChain.doFilter(wrapper, res);
          }finally{
            ReentrantLock lock = wrapper.getLock();
            if (lock != null && lock.holds() != 0)
                       lock.release(lock.holds());
    the Wrapper
    final public class SessionThreadRequestWrapper extends HttpServletRequestWrapper {
      private ReentrantLock lock = null;
       * Constructor for SessionThreadRequestWrapper.
       * @param arg0
      public SessionThreadRequestWrapper(HttpServletRequest req){
        super(req);
       * @see javax.servlet.http.HttpServletRequest#getSession()
      public HttpSession getSession(){
        return getSession(true);
       * @see javax.servlet.http.HttpServletRequest#getSession(boolean)
      public HttpSession getSession(boolean construct){
        //this will get the session an the lock
        HttpSession session = getLockFromSession(construct);
        if (session == null) return null;
        //get a lock on the mutex
        try{
          lock.acquire();
        } catch (InterruptedException e){
          throw new IllegalStateException("Interrupted while thread waiting for session");
        //now we check again if the session is still valid
        try{
          session.getAttribute(SessionThreadFilter.MUTEXT_IN_SESSION_KEY);
        } catch (IllegalStateException e){
          //again we go recusively but first release the lock
          lock.release();
          lock = null;
          return getSession(construct);
        //after you got the lock you can return the session
        return session;
       * gets the lock from the session
       * @param construct
       * @return HttpSession
      private HttpSession getLockFromSession(boolean construct){
        //test if it is a new Session
        HttpSession session = super.getSession(construct);
        //if is null no session was realy requested
        if (session == null) return null;
        //otherwise try to get the lock if necessery construct it
        //syncrhonized over session
        synchronized (session){
          //this migth throw an Exception if the session has been
          //invalidated in the mean time
          try{
            lock = (ReentrantLock) session.getAttribute(SessionThreadFilter.MUTEXT_IN_SESSION_KEY);
            if (lock == null){
              lock = new ReentrantLock();
              session.setAttribute (SessionThreadFilter.MUTEXT_IN_SESSION_KEY, lock);
            return session;
          } catch (IllegalStateException e){
            //the session has been invalidated before we tried to get the
            //lock we recursively call getLockFromSession
            //( assumption checked with Jetty: if the session is invalidated
            //and getSession is called on the thread a new valid session
            // should is returend)
            //I hope sometime you should get a valid session but I am not
            //sure. This is crucial for breaking of the recursion
            lock = null;
            return this.getLockFromSession(construct);
      /** used by the Filter to get the lock so that it can release it
      ReentrantLock getLock(){
         return this.lock;
    }As stated I would be very thankful if you could check the code and give some commends.

    synchronized (session){Are you sure that the session instance returned by two
    concurrent calls to getSession(...) are the same? I
    think that tomcat for instance may return different
    instances for the same "logical " session, which would
    break your scheme I think... Thank you (I did not know that on Tomcat). The same thing could also occur if another filter wrapped the Session.
    That's indeed a problem,which I have already adressed in another thread, but did not get an answer. ( http://forum.java.sun.com/thread.jsp?forum=33&thread=412380). The already cited thread http://forum.java.sun.com/thread.jsp?forum=4&thread=169872 adresses the same problem, but the discussion there ends with the recomandation that you should synchronize on HttpSession as I did it. Also in other forums I've read so.
    However like you I've at least strong doubts in this approach, so now my question is on what should I than generally for any access in any web-app syncrhonize the access to Http-Session as demanded by the Servlet specs.
    A few not realy satisfying answers:
    Synchronize on the HttpSession itself: I think still the best approach, but as you say is it guaranteed that the same instance of an HttpSession is given to each Request (in one Session)?
    Synchronized on the HttpServlet: This only works if no other servlet (or jsp) accesses in the session the value with the same key ( of course only if the session itself is threadsave). In case of ThingleThread it is not possible at all there can be multiple instances (you could use a static variable)
    Holding the object to synchronize on in applicaton scope or session scope: This obiously doesn't help, because somehow you have to obtain the lock and at least there you need another synchronize.Holding in application socpe is slow a static variable lock would be better there.
    Synchronize on some static variable: This will work, but is very slow (each request not only in the same session would synchronize on this).
    Hold a map in application scope, which holds for each Session-key a lock: Is probably faster than the static variable thing. However the access and the management of the Map (removing of unused locks etc.- Mabe you could use a WeakHashMap to collect the locks for not used keys anymore) is time consuming too and again the map must be accessed syncrhonasly by all requests.
    Syncrhonize on the Filter (only in my case): This is as slow as the static variable approach because each request will use the same lock the one instance of the Filter.
    So synchronizing on the session is propably the best approach if the same attribute name is accesed by different servlets. However if you say that some Web-Containers return different HttpSession instances for the same Session (which is legal according to the specification) this of course does not work.
    So I have realy no clue on what to syncrhonize than. Now help is not only neede on my Thread serialization filter but on my generally Servlet prgromming.
    May be you could help me for another synchronization aproach.

  • Autocomplete suggests my user ID and date of birth on the log in page of my savings account - how do I stop this?

    For the most part autocomplete is really helpful. However, when I log in to my savings account, my user ID and DOB are suggested, allowing anyone on my PC to view my account (a security code is required to carry out any transactions which does not appear to be autocompleted!) - how can I switch this off please? This has started since I reset Firefox (due to slowness, as recommended by Firefox). Thanks.

    Thank you jscher2000: all fixed now!

  • How to make show iChat date as well in the log

    iChat shows in the protocol the time. I want also to see the date, because we use iChat mainly for inter office communication and sometimes I want to know at what date a certain message has been sent.
    How can I get that option set?

    Use the ichat plugin chax it has log viewer.

  • Filter or Window function from the analysis Library

    Friends,  
    I will be collecting about 20,000 data points.  I would like to reduce the number of points to plot to about 300 to 500 points.  (i call this filtering)   I know there is an Advanced Analysis Library function that would do this;  which one would be the best?  
    Dave    

    Hi,
    one possibility without even using the Advanced  Analysis Library is to use the 'point frequency' parameter in PlotXY:
    PlotXY ( plot_handle, graph_control, x_array, y_array, 20000, VAL_DOUBLE, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 40, VAL_RED); this would plot every 40th point out of your 20000 data points.

  • The data storage function on the Zen Mi

    I have just bought a Micro Zen and I'm waiting to receive it... One of the reason I went for the Micro Zen is that it also allows me to store data on it. But talking to a friend who has one, I realized something : she tells me the Zen Micro is all fine and good to transfer data between computers like you would with any USB key but the thing with the ZM is that you need to install a software on both computers before being able to transfer any file? My USB key works on any computer without installing anything, which is what makes it so practical... what's the use of the storage data function if you can't, for example, use it to bring back home files you've worked on at work / college (the problem being you can't install anything on a public access computer...), or even at a friend's?
    Thanks

    Thanks a lot!!
    And don't worry I've paid and bought the Creative Zen Micro, it's not to go buy an Ipod now... but the micro zen'd better li've up to my expectations!!

  • Remapping function keys the way users need them to

    Expose was a feature that I used seamlessly when going between apps on a MacBook. Ever since I got a MacBook Pro it's been frustrating using Expose and Spaces ever since.
    1. I never did use the hot corners. Way too many inadvertent calls, especially if you use all three. Plus, using the function keys are a lot faster.
    2. OK, so we finally don't need to use two hands for right-clicking, but why do we now need it for Expose and Spaces? When going between apps, my finger drifted easily and rapidly to F8, F9 and F10, but now I have to use two hands? This is especially annoying when you're just in review mode and using only one hand, on the phone, lounging, etc.
    3. I know I can reverse the function keys, but I'd like to control volume and screen display with one hand as well.
    Feature request: Rather than have a universal one-check-box switch between function keys and special features printed on the keys, I would absolutely be a lot more efficient and quicker in my workflow if I was simple allowed to choose whether I wanted each individual function key to be the special feature or a standard function. In other words, I'd like to use one hand to control volume, screen display, Spaces, and Expose. The backlit display and desktop viewer switch features are seldom if ever used for me - kind of a waste of efficiency.
    DoubleCommand, previously suggested, doesn't do this. Does anything?

    Thank you, I already did, but that's not the point of this post. The feature request is a small part of the message to explain what I'm looking for, either as a script or third party app or something I'm overlooking, or if I am indeed completely out of luck and that my only option was to have submitted a feature request.
    Message was edited by: Tux Kapono

  • How to get the EBS login user id  from a current Logged User

    Hi,
    I need to get particular Logged user's User ID & filter out his business group id to taken it as the concurrent input parameter.
    this can be done through a value set if i know logged user's user id but i have no idea how to find the logged user's user id.....!!
    i get user id such SessionMgr,fnd_profile API's???
    any suggetions appreciable...
    Regards,
    D f o r z
    Edited by: Dforz on May 5, 2011 10:40 PM

    By CO Gyan means OAF Controller. Are you sure your question is related to OA framework forums.
    Let us know where exactly in OAF you want to capture these ids and pass it to concurrent program.
    I think you should post your question to below forum
    General EBS Discussion
    Thanks
    AJ

  • Viewing the logged front panel data

    I’m writing into the datalog file, I can see that the data is recording every one second, but when I retrieve the data i.e. viewing the logged front panel there is only one data since the range is from 0 to 0 ([0..0]). Does anyone know why? And how can I fix the problem?

    You should Never rely on the abort button on the tool bar to stop a VI in a loop writing to a file. The abort stops everything immediately and you don't properly close the file. Instead of using a boolean contant in your loop to get you an endless loop, add a Stop button (a boolean switch) to your front panel. Wire that through an inverter to the Continue terminal of the loop, or (if you're using LabView 6.x) right-click on the Continue terminal and change to Stop if True, then wire the Stop button directly to the terminal. Then pass the file RefNum out of the loop to the Close File function.
    For debugging purposes, I do use the Abort toolbar button, but I never create a VI with the Abort as the only means of stopping a VI. Anytime you want to st
    op a VI in a loop, you may want to have some control over how it stops. There may be files to close, instruments to shut down, results to process, etc. Even if the VI is very basic or even temporary, just get in the habit of using a Stop button on your front panel rather than a boolean constant to get an endless loop. It's really not that much more work and it gives you control over your VI.

  • How to retrieve the username/password of logged user so to use web services

    Hi Experts,
    we are using web services from a web dynpro application, the web services we use are CAF web services; actually we are "hardcoding" username and password so to be able to execute these web services, using this code before calling the web service:
    wdContext.currentRequest_ReporteDeRendicionDetallada_RElement().modelObject().setInvokerProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY,"testuser");
      wdContext.currentRequest_ReporteDeRendicionDetallada_RElement().modelObject().setInvokerProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY,"testpassword");
    but as this is not a very good practice, we want to replace the "testuser" with the logged user and, of course, retrieve the password and use it instead of "testpassword".
    How can we achieve this? I couldn´t find any tips on this.
    Best regards,
    Marco.

    Hello,
    thanks for your anwsers, although I´ve followed both links I couldn´t find the answer to my problem.
    I need to know how to retreive user and password from the UME of the portal so to be able to execute web services in the java stack, the UME is connected to a LDAP in our corporation.. so may be the passwords are not stored in the UME?
    If it is not possible to retrieve the passwords of the users , which is the best practice to deal with username/passwords to execute CAF webservices from web dynpro java? Hardcoding is not a very good practice..
    Best regards,
    Marco.

Maybe you are looking for