cancel
Showing results for 
Search instead for 
Did you mean: 

How do you access the user's portal login id?

Former Member
0 Kudos

Hi ALL,

When i try to capture all the portal login id to a report using the following code

IUser epUser = null;

String portalUser = "";

try {

IWDClientUser user = WDClientUser.getLoggedInClientUser();

epUser = user.getSAPUser();

portalUser = epUser.getUniqueName();

}

} catch (Exception e) {

}

or even

IWDClientUser user = WDClientUser.getCurrentUser();

It is giving me this output in my report

USERID

93

93

93

93

if i give authentication = true, it asks for a login. and if i enter with a "administrator' login, it gives me

USERID

administrator

administrator

administrator

How can i get all the portal login id? Why number is reflecting instead of ID's?

Regards,

Divya

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

answered

Former Member
0 Kudos

Hi u can write the following code in init() of Component controller

IWDClientUser wduser;

try

{

wduser=WDClientUser.getCurrentUser();

Iuser user=wduser.getSAPUser();

if(user!=null)

try

{

IUserAccount acct[]=user.getUserAccounts();

if(acct[0]!=null)

{

String userid=acct[0].getLogonUid();

}

}

catch(UMException e1)

{

e1.printStackTrace();

}

}

catch(WDUMException e)

{

e.printStackTrace();

}

former_member197348
Active Contributor
0 Kudos

Hi Divya,

The below code is working for me. You can try with this: This is for currently logged in User.

String userName = "";

IWDClientUser wdUser = null;

try

{

wdUser = WDClientUser.getCurrentUser();

}

catch (WDUMException e)

{

wdComponentAPI.getMessageManager().reportException(e.getLocalizedMessage(), false);

}

IUser usernam = wdUser.getSAPUser();

userName = usernam.getUniqueName();

regards,

Siva

Former Member
0 Kudos

Hi,

Thanx for the reply.The userid is retrieved. But it is shown only if we give"Authentication=true". If i give authentication="False', it gives me "500 internal Server Error". So is it that we have to give Authentication=true".

Also...is it possible to retrieve to trace using webdynpro Java the userIds of all the users who all have logged in the portal "Today". Please help in this issue.

Regards,

Divya

former_member197348
Active Contributor
0 Kudos

Hi,

Real time you don't get "500 internal Server Error" because the user access this application through portal. So WDClientUser.getCurrentUser() always returns logged in user.

I am not sure about APIs for this requirement the userIds of all the users who all have logged in the portal "Today". But there are some reports called "Activity reports" in Portal.These reports provide various metrics about user activity details. Check whether these reports are of any use. Right now I don't have access to the portal otherwise I would have provided you more details.

regards,

Siva