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

How to get User Name in AbstractPortalComponent

Hello!

Can s.o. tell me how to get the user from doContent()-Area within an AbstractPortalComponent (not JSPDynPage). I saw that there is an Interface IUserContext, in some example i saw another Interface "IUser", but that is not reachable for me.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 08:11 AM

    Hello Karpenstein,

    Why is IUser not reachable for you?

    Usually you would use that exact object to get User information.

    IUserFactory userFact = UMFactory.getUserFactory();
    userFact.getUser(String uniqueID)

    The package that you need to import is com.sap.security.api.*;

    Hope that helps.

    Cheers,

    Hermann

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 08:32 AM

    Hi,

    you have some different methods, choose the one which fits more to your requirements:

    getUniqueName() --> will display access ID

    getUid() or getUniqueID() --> will display unique ID

    getDisplayName() --> will display surname and name

    as has told Hermann do the import com.sap.security.api.*; where you have included import com.sap.security.api.IUser; which is the package you need.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 08:40 AM

    ...

    import com.sap.security.api.IUser;

    import com.sap.security.api.IUserFactory;

    import com.sap.security.api.UMFactory;

    import com.sapportals.portal.prt.component.AbstractPortalComponent;

    import com.sapportals.portal.prt.component.IPortalComponentRequest;

    import com.sapportals.portal.prt.component.IPortalComponentResponse;

    ...

    public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)

    {

    ...

    IUserFactory userFact = UMFactory.getUserFactory();

    IUser me = request.getUser();

    ...

    String accessid = me.getUniqueName();

    String uniqueid = me.getUniqueID();

    String name = me.getDisplayName();

    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.