Get current logged portal  user information

Hi,
I need to get information about current user logged to the portal from a J2EE application. I developed an Enterprise application project with a java servlet and I integrated it into the portal as an URL iView.
This in the code of servlet:
import com.sap.security.api.*;
IUserFactory userFactory= UMFactory.getUserFactory();
     IUser user= UMFactory.getAuthenticator().getLoggedInUser();
     out.println(user.getUniqueID().toString());
     out.println(user.getDisplayName().toString());
     out.println(user.getName().toString());
     out.println(user.getUniqueName().toString());
When I run my application I have this output:
USER.PRIVATE_DATASOURCE.un:Guest Guest, Guest Guest
But I access with another user, it's not Guest.
How can I solve this problem???THANKS

Hi,
Please try checking with following code
ISearchResult rst = UMFactory.getUserFactory().getUniqueIDs();
                  IUserFactory usf = UMFactory.getUserFactory();
                  IUser iuser = null;
                  IUserListElement userElement = null;
                  int i = 0;
                  while (rst.hasNext()) {
                  iuser =  UMFactory.getUserFactory().getUser(rst.next().toString());
                  String email = iuser.getEmail();
                   String fname = iuser.getFirstName();
                    String lname = iuser.getLastName();
let me know if there are any issues.
regards
Anil

Similar Messages

  • How to get current logged-in user name in data access driver or in universe

    In universe, to get the current log in user is via @Variable('BOUSER').
    Right now, I need to be able to get the user name in the data access driver. I am writing a customized data access driver because we need to patch some where clause on the the query generated by the universe based on the logged-in user info. I only think of using end_sql parameter or adding an universe level filter to patch the @Variable('BOUSER') to the query, which would not work if user want to use customized query.
    Can anyone tell me how to get currentBO user name from connection server ? or how @Variable('BOUSER') is translated into the logged-in user name in the universe?

    I do not know your EJB Service. But you should pass the credentials of the current logged on portal user to your service. That's not by default I think.
    I had a similar problem with CAF developed webservices. I had to turn on permission checks in my web service and passed the credentials via logon ticket.
    Regards, Bernd

  • How to get Current Logged in user in Java

    Hi All ,
    I have written a code in to get the current logged in user in the portal in an EJB service.  I have used the code
    *IUser user= UMFactory.getAuthenticator().getLoggedInUser();*. But surprisingly the userId which it returns is always is Guest. Can you please help on this issue.
    Thanks & Regards,
    Rohit

    I do not know your EJB Service. But you should pass the credentials of the current logged on portal user to your service. That's not by default I think.
    I had a similar problem with CAF developed webservices. I had to turn on permission checks in my web service and passed the credentials via logon ticket.
    Regards, Bernd

  • OIM11gr2 - How to get currently logged in user details using oim api

    Hi All,
    I have a requirement to retrieve currently logged in users profile in the process adapter.
    I have tried with getSelfProfile in tcUserOperation and also ContextManager.getOIMUser API's however, in both the cases i am getting xelsysadm details only.
    Also as know request details in Process task mapping doesnot work for OIM11g onwards (its returning column not found exception )
    DOes any one has idea how to achieve this.
    PS. - i am using platform to retrieve API's.
    Thanks & Regards
    Swati Pandey

    You can get the logged in user name using the below java code:
    ADFContext adfCtx = ADFContext.getCurrent();
    SecurityContext secCntx = adfCtx.getSecurityContext();
    String user = secCntx.getUserPrincipal().getName();
    HTH

  • Get current logged in user in sharepoint 2013 hover display template

    Hi,
    Can somebody tell me how the current logged in username can be retreived in hover display template to be used in search result.
    i tried using rest api but that is very difficult to get as it is to be done using ajax call and if we do getting a return value asynchronous is difficult.
    Please help

    Hello,
    You might use the function used in the Visual Studio SharePoint App template:
    var context = SP.ClientContext.get_current();
    var user = context.get_web().get_currentUser();
    $(document).ready(function () {
    getUserName();
    function getUserName() {
    context.load(user);
    context.executeQueryAsync(onGetUserNameSuccess, onGetUserNameFail);
    function onGetUserNameSuccess() {
    $('#message').text('Hello ' + user.get_title());
    function onGetUserNameFail(sender, args) {
    alert('Failed to get user name. Error:' + args.get_message());

  • How to get current logged in user's star rating in SharePoint 2013

    Hi,
    Currently,  I am developing a custom web part to show star rating for documents, everything is done.
    However,when user hover on the star I want a tooltip message("Your current rating is 1..."), similar to what we have 
    in libraries(or what the sharepoint by default provides in libraries) . So can I get the user specific rating depending upon 
    the logged in user using code(.net or CSOM anything will work)

    using the below code you can get the rated by user along with the rating , it's easier to just notify the user that her already rated the document 
    var acontext = new SP.ClientContext.get_current();
    var lists=acontext.get_web().get_lists();
    var l =lists.getByTitle("Documents"); //your document libraty
    var aitem=l.getItemById(27);//Item id
    acontext.load(aitem, "RatedBy", "ID", "Ratings");
    acontext.executeQueryAsync(function(){
    var RatedBy= aitem.get_item('RatedBy');
    if (!SP.ScriptHelpers.isNullOrUndefined(ratings)) {
    for (var i = 0; i < RatedBy.length; i++) {
    var user = RatedBy[i];
    if (user.get_lookupId() == _spPageContextInfo.userId) {
    //show that you already rate it
    break;
    },function(s,e){alert(e.get_message());});
    another way is to use CAML query to check if the current user id is within the RatedBy multi user field
    Hope that helps|Amr Fouad|MCTS,MCPD sharePoint 2010

  • How to get currently logged in user on 'Bill of Material' Form in Add-Mode

    Dear All,
                    I am using a UDF on 'Bill of Material' Form in SAP. This UDF is named as Current_User. I want in this UDF the user name that is currently logged in to SAP. I am able to get user name at form load event. But when 'Bill of Material' Form comes in ADD Mode, the user name doesn't display. What can I do for this problem.? Here is my code:
    public override void Handle_SBO_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
                BubbleEvent = true;                 
                try
                    if ((mst_FormUIDModal != null))
                        if (FormUID != mst_FormUIDModal)
                            bool dbo_FormFound = false;
                            foreach (SAPbouiCOM.Form dsa_Form in this.SBO_Application.Forms)
                                if (dsa_Form.UniqueID == mst_FormUIDModal)
                                    if (FormUID != mst_FormUIDModal)
                                        if (this.SBO_Application.Forms.Item(mst_FormUIDModal).Selected == false)
                                            this.SBO_Application.Forms.Item(mst_FormUIDModal).Select();
                                        BubbleEvent = false;
                                        return;
                                    dbo_FormFound = true;
                            if (!dbo_FormFound)
                                this.mst_FormUIDModal = null;
                    if (pVal.BeforeAction == false)
                        switch (pVal.EventType)
                            case BoEventTypes.et_FORM_LOAD:
                                    if (pVal.FormType == -672)
                                        Program.Curr_User = SBO_Company.UserName;
                                        doc_form = this.SBO_Application.Forms.GetForm(pVal.FormType.ToString(), pVal.FormTypeCount);
                                        ((SAPbouiCOM.EditText)doc_form.Items.Item("U_User").Specific).Value = Program.Curr_User;
                                } break;

    Hi,
    You need not to write any sdk code for this task. You just create a user query as mentioned above and save it with some name.
    Then Open the Bill Of Material Screen, just click in the required field, then click alt + shift + f2 to assign a Formatted Serach.
    Then Select 3 rd Option       "Search in Existing User-Defined Values According to Saved Query"
    Then Click on the button "Open Saved Query"
    It will open the Query Manager. Select the Saved Query.
    Enable the Option "Auto Refresh When Field Changes"
    In the Drop Down list, select the Value "Parent Item"
    Then Select the Option Refresh Regularly or Display Saved Values.
    This will automatically put the user code if the parent item is selected.
    You an achieve this by without SDK Code.
    PS:
    There is a change in the Above Query:
    Select USER_CODE from ousr where userid = $[USER]
    Edited by: Manikandan K on Dec 22, 2011 2:00 PM

  • Command in JSP to get current logged in user.

    Hello Experts,
    We have a web page written in JSP.
    Once we call to this web page. I want to fetch username of the person who has logged in currently to system.
    is there is any single word command to get this ?
    Thanks In Advance..
    Avinash Shrivastava

    avinash101 wrote:
    Hi BalusC,
    First of all Thanks for your reply, but this JSP page will be saved in Server and user will access this site from client machine.
    Please suggest how to go in this scenario.
    Thanks Again,
    AvinashJSP runs at the server machine. It would only return the user name of the server machine. All what the client got is the HTML output produced by JSP, it doesn't get any line of JSP/Java code. You need to run Java at the client machine. A signed applet and web start app can do that.

  • Get current logged in user's Apple ID

    Hi,
    I'm trying to implement a rating feature on an app I'm developing, but it's giving me a problem wich is that every user of the app can rate something one and only one time, wich means I can't use his/her IP nor MAC Address, I need something global like the user's e-mail associoated with apple's account, Apple ID or wathever it is that distinguishes users in the App Store. So, is there a way of getting this information in AIR or native language (so I can create an ANE)? Just a simple method that returns the user's ID is what I need.
    Thanks in advance.

    Ok, after some ersearch I found an extension by MilkmanGames called RateBox, here are some links:
    http://www.milkmangames.com/blog/tools/#ratebox (for the extension)
    http://www.adobe.com/devnet/air/articles/ratebox-ane-ios-android.html (for a tutorial)
    Can anyone confirm if this works for rating in-app purchases? I don't wanna buy this without knowing if it'll really work for what I want.

  • Currently Logged in User

    Dear Experts
    i would like to know that how can we get the currently logged in user through query or some other option, as i want to generate different document series for every single user.
    Secondly, if i have a party which is my customer as well as my vendor, how i can perform netting so as to get the recievables and payables for the particular party.

    Hi,
    One way to get current logged in user list is through the XML file on the licensing server.  Otherwise, you can get current user by
    Select T0.U_Name From dbo.OUSR T0 Where T0.UserID = $[USER\].
    What is your B1 version and PL? It may not be the same for 2005 or 2007 to handle those BP with both types.
    Thanks,
    Gordon

  • Getting Logged on User'Information in an Oracle-Form SSO Partner Application

    Hi.
    I could run Flight-of Fancy Application and capture user's information by calling the
    "Parse_cookie " Procedure.(use the Scenario 2 - Access the Portal and then the FOF App)
    and defined an Oracle-Form application as Partner application like FOF.
    I want to have Logged on user'Information in the "Oracle-Form" . But the Fucntion owa_cookie.get dosen't work correctly.please let me know what can I do ?
    Thanks in advanced.

    Hi.
    I could run Flight-of Fancy Application and capture user's information by calling the
    "Parse_cookie " Procedure.(use the Scenario 2 - Access the Portal and then the FOF App)
    and defined an Oracle-Form application as Partner application like FOF.
    I want to have Logged on user'Information in the "Oracle-Form" . But the Fucntion owa_cookie.get dosen't work correctly.please let me know what can I do ?
    Thanks in advanced. If you're writing your own partner application, then you are correct to get the user information from the output variables
    from the parse_url_cookie procedure. You should then set the information you want to keep track of in the cookie, or combination
    of cookie and persistent storage in the database. Take care of the security implications while doing this.
    On subsequent calls to your application, the user info should be obtained from the cookie and the database, if you
    are using a combination of the cookie and database storage to keep your info.
    The owa_cookie.get routine is used to read the cookie, which is generated with owa_cookie.send.
    These routines work fine, when invoked correctly.
    If you are having trouble with them, you're probably not using the calls properly.
    The following code provides an example of how to use the owa_cookie calls...
    create or replace package testcookie
    is
        procedure show (p_name IN VARCHAR2);
        procedure send
            p_name    IN VARCHAR2,
            p_value   IN VARCHAR2,
            p_path    IN VARCHAR2 default null,
            p_expires IN VARCHAR2 default null
    end testcookie;
    show error package testcookie
    create or replace package body testcookie is
        procedure show (p_name IN VARCHAR2) is
            v_cookie owa_cookie.cookie;
        begin
            v_cookie := owa_cookie.get(upper(p_name));
            htp.htmlopen;
            htp.bodyopen;
            htp.print(v_cookie.vals(1));
            htp.bodyclose;
            htp.htmlclose;
        exception
            when others then
                htp.htmlopen;
                htp.bodyopen;
                htp.print('NO COOKIE FOUND.');
                htp.print(SQLERRM);
                htp.bodyclose;
                htp.htmlclose;
        end;
        procedure send
            p_name    IN VARCHAR2,
            p_value   IN VARCHAR2,
            p_path    IN VARCHAR2 default null,
            p_expires IN VARCHAR2 default null
        is
            v_cookie owa_cookie.cookie;
            l_agent varchar2(30);
            l_expires varchar2(30);
            l_path varchar2(100);
        begin
            if p_expires is null then
                l_expires := null;
            else
               l_expires := to_date(p_expires, 'MMDDYYYY');
            end if;
            if p_path = 'ALL' then
                l_path := '/';
            else
                l_path := null;
            end if;
            owa_util.mime_header('text/html', FALSE);
            l_agent := owa_util.get_owa_service_path;
            l_agent := substr(l_agent, 1, length(l_agent) - 1 ) ;
            owa_cookie.send(
                name    => upper(p_name),
                value   => p_value,
                expires => l_expires,
                path    => l_path
            owa_util.http_header_close;
            htp.htmlopen;
            htp.headopen;
            htp.headclose;
            htp.bodyopen;
            htp.print ('Cookie set.');
            htp.bodyclose;
            htp.htmlclose;
        end;
    end testcookie;
    show error package body testcookie;
    grant execute on testcookie to public;If you load this into a schema which a DAD can access, then you can invoke the show and send procedures to view and
    generate cookies.
    To generate a cookie, issue the following from your browser ...
    http://server.domain.com/pls/dad/schema.testcookies.send?p_name=test&p_value=hello
    To view the cookie:
    http://server.domain.com/pls/dad/schema.testcookies.show?p_name=test

  • How to get the name of currently logged in user in the network

    Hi all,
    I want to know if there's a way to get the name of the currently logged in user in the network.
    SYS_CONTEXT('USERENV','OS_USER') won't work for me because our users do not loggin in portal.
    Any ideas?
    Thanks in advance.
    Brett

    Hello, I had the same problem. Here is a smaller version to find the Group of the current User.
    The VI get the members of a Group and match it with the Username.
    Note :
    If the User belongs to multiple Groups the the VI returns only the 1st Groupname
    If the User belongs to no Group then the VI returns "unknown Group"
    The VI is written with LabVIEW 2010 and TestStand 4.2.1
    Attachments:
    current user group.vi ‏20 KB
    TestStand get Group of current User.PNG ‏43 KB

  • Get the current Logged on User on Mobile Client

    Hi
    I have to display the current logged in User of the Mobile client in my application. I think I have to use the User and UserManager API for that. But the thing is I am not able to instantiate the class to use the methods in it.I think I have to create a session object for using these classes, but in Session API I can see that I will have to create a new session and I want to use the current session.
    Please tell me how to use these APIs and get the instance of User or UserManager.
    Regards,
    Priya

    Hi Priya,
    You can try with:
    User user = UserManager.getInstance().getCurrentUser();
    The User interface has methods to get relevant information (for ie. getName() or getFirstName()), take a look on the [javadocs|http://help.sap.com/javadocs/nwmobile/SP3/laptops/com/sap/ip/me/api/user/User.html]
    Best Regards,
    Simon.

  • How to get Current Log in BO user name in data access driver

    In universe, to get the current log in user is via @Variable('BOUSER').
    Right now, I need to be able to get the user name in the data access driver. I am writing a customized data access driver because we need to patch some where clause on the the query generated by the universe based on the logged-in user info. I only think of using end_sql parameter or adding an universe level filter to patch the @Variable('BOUSER') to the query, which would not work if user want to use customized query.
    Can anyone tell me how to get currentBO user name from connection server ? or how @Variable('BOUSER') is translated into the logged-in user name in the universe?

    Shweta,
    The link you provided was the Auditor guide for BO 6.x, I'm not sure it that is going to help Karen or not.
    Karen,
    There is function called connection
    (usage:  =connection([Query Name]), where [Query Name]
    denotes the name of the tab for the query under Edit Query)
    Here is some of the output from connection:
    4;ODBC18;MS SQL Server 2000166; VERSION=7; USER=xxxxx;
    PASSWORD=; DBTYPE=Relational; DATABASE=xxx_xxxx;
    ODBC_USER=xxxxxx; ODBC_PASSWORD=; BO_DSN=xxxx_xxxx;
    BO_DRV_CONNECT_MODE=0; 224; VERSION=6; Name=xxxxx; Shared=4;
    LoginTimeout=600; Timeout=600; Pool Time=60; Array Fetch Size=10;
    Array Bind Size=5; RecommendedLenTransfert=1000; Password_Encryption=x;
    AliasTable=; MeasureDimension=; Hint=; ConnectInit=; ArrayFetch=1;
    I'm not sure if this info helps out either, being that connection provides info on a post-processing basis and it sounds like you need to get out ahead of the SQL generation.  The @variable('bouser') would seem like the place to be, however, in allowing custom SQL to take place you loose the bouser due to an individual could customize the SQL to the point that it gets unwantingly yanked out.  The end_sql might be your answer...
    Thanks,
    John

  • CAML query to get task assigned to current logged in user

    I want to know the CAML query to get tasks assigned to the currently logged in user
    Nour

    Hi,
    This is the query that worked for me
    <Where>
    <And>
    <Or>
    <Membership Type=’CurrentUserGroups’>
    <FieldRef Name=’AssignedTo’ />
    </Membership>
    <Eq>
    <FieldRef Name=’AssignedTo’  LookupId=’TRUE’ />
    <Value Type=’Lookup’>123</Value>
    </Eq>
    </Or>
    <Neq>
    <FieldRef Name=’Status’ />
    <Value Type=’Text’>Completed</Value>
    </Neq>
    </And>
    </Where>
    Regards,
    Nishant Rana
    http://nishantrana.wordpress.com https://twitter.com/#!/nishantranacrm

Maybe you are looking for

  • International texts are not being received?

    Hello folks I have an iPhone 5. I can make and receive local and international calls. I can send and receive local text messages. I can receive international text messages but cannot send them. I have an International calling and texting plan. iMessa

  • Ibook video output

    does the video adapter for current ibooks require that the tv you are connecting to has an s-video connection? if so, is there any other kind of cable/accessory available that will give you either an av or scart connection - like the video adapter fo

  • How do you make a movie clip play in CS4

    Hello, I used Flash MX a long time ago (beginner level) then left it for years. I'm now using CS4 and am stuck. I have a stage with a movie clip placed onto it. I want to create a simple 'click to play' button so that the movie clip only plays on cli

  • IdeaCentre B320 black screen

    My Ideacentre B320 gets a black screen on startup but I can hear Windows starting normally and when I try the TV I only get the Lenovo logo screen and nothing else. I found a post from someone with the exact same problem but with a B340. It turned ou

  • Why do we pay so much money for Apple but no device can stand a fall? Even with a case.

    I feel that apple should make better products that look good and is durable. That's crazy how we all spend over $200 on a product and the moment you may accidentally drop your device, the whole thing shatters. I had put a otter box on my device and,