Skip to Content
author's profile photo Former Member
Former Member

How to reference the current user ID from a Java iView (EP5)

Hi,

We are on EP5 and an early service pack (SP2 I think) and we are trying to work out what Java code we need to use to reference the user ID of the user that is currently logged on.

We have tried using the iUser object but we get NULL values.

Our EP is running on Windows and hooked into our corportate LDAP if that makes any difference.

We can get it to work on a local workstation using the PDK but that will only show the user that has typed in their username and password to login to the PDK via its web page. We want to see the Windows username that is logged on to the workstation.

Our EP portal is doing authentication automatically out of the box and it shows the user's name in the top-right of the screen, we just can't seem to be able to work out how to query the user ID from Java code.

If someone knows how to do this it would be appreciated.

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 08, 2004 at 07:10 AM

    Hi,

    you have to get an instance of the IPortalComponentRequest like:

    doInitialization() {

    IPortalComponentRequest request = IPortalComponentRequest) this.getRequest();

    IUser loggedOnUser = (IUser)request.getUser().getUser();

    String user = loggedOnUser.getId();

    }

    Regards,

    Gerhard

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Brendan, hi Gerhard,

      user.getID()
      

      in LDAP environments could return the DN (in my 2001 JavaDocs for EP it is described that "this is currently the case for groups").

      At least one of these two should do (only EP5):

      String userID = request.getUser().getUserID();
      String userID = ((IUser) request.getUser().getUser()).getDisplayID();
      

      Hope it helps

      Detlev

  • author's profile photo Former Member
    Former Member
    Posted on Dec 08, 2004 at 07:14 AM

    Thanks Gerhard, we'll give it a go.

    Rgds,

    Brendan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 11, 2005 at 03:31 AM

    Hi,

    Some of the apis in KM need IUser object of the older version of User Mgt of type 'com.sapportals.portal.security.usermanagement.IUser'

    But the method request.getUser().getUser() is deprecated. Is there some better way to get the IUser object of the older version

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.