cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get UserID of a logon User

Former Member
0 Kudos

Hi Guys,

I am currently implementing a dynamic site map on my Enterprise Portal version 6 SP 9. I am trying to create a site map such that every user that log on to the portal will see the object assigned to him.

My problem is that I want know the API or class to use to get the logon user ID.

I will appreciate you help.

Thanks.

Dakata A Ibrahim

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Abdu,

Try this code:

String logonID = user.getUid();

IUserAccount accounts[] = null;

try {

accounts = user.getUserAccounts();

} catch (UMException e) {

response.write(("<br>Error getting accounts: " + e.getLocalizedMessage());

}

if (accounts != null) {

response.write("<br>Number of Login Accounts: " + accounts.length);

for (int i = 0; i < accounts.length; i++) {

response.write(

"<br>** Login ID #" + i

+ ": LogonUID=" + accounts.getLogonUid()

+ ", AssignedUID=" + accounts.getAssignedUserID());

response.write(

"<br>Last Login: "

+ accounts.getLastSuccessfulLogonDate().toString());

response.write(

"<br># Logins: " + accounts.getSuccessfulLogonCounts());

}

}

Regards,

Pooja.

Former Member
0 Kudos

Hi Pooja,

Thanks for the help. Let me explain to you clearer what I want to do. What I wanted is a single line code in java that capture my username and assign to a variable when I log on to the portal.

Thanks alot

Dakata A. Ibrahim

Former Member
0 Kudos

String logonID = user.getUid();