cancel
Showing results for 
Search instead for 
Did you mean: 

Read current login id of portal

Former Member
0 Kudos
218

Hi,

How colud i read the user id of the portal who logged in.....

Here is the code i wrote to read....

IWDClientUser user = WDClientUser.getLoggedInClientUser();

IUser iuser = user.getSAPUser();

String userid = iuser.getDisplayName();

wdContext.currentZemp_Dob_Alerts_InputElement().setUname(userid);

IWDMessageManager manager = wdComponentAPI.getMessageManager();

manager.reportSuccess(iuser.toString());

But when i loggin to the portal, i m getting below error....

                                                                                                                  • * com.sap.security.core.persistence.imp.PrincipalDatabag Mon Apr 21 10:00:24 IST 2008 * UniqueID: USER.PRIVATE_DATASOURCE.un:sep_amar * Type: USER * Home data source: PRIVATE_DATASOURCE * Private id part: un:sep_amar * * Existence not checked. * * "com.sap.security.core.usermanagement"|->"j_authscheme" (no time limit)="basicauthentication" * "com.sap.security.core.usermanagement"|->"MYSAPSSO2_STRING" (no time limit)="AjExMDAgAA9wb3J0YWw6c2VwX2FtYXKIABNiYXNpY2F1dGhlbn... (total length: 468 characters)" *************************************************************************** Persistent data: *************************************************************************** * com.sap.security.core.persistence.imp.PrincipalDatabag Mon Apr 21 10:00:24 IST 2008 * UniqueID: USER.PRIVATE_DATASOURCE.un:sep_amar * Type: USER * Home data source: PRIVATE_DATASOURCE * Private id part: un:sep_amar * * Principal exists. * * Direct parents: * GRUP: GRUP.SUPER_GROUPS_DATASOURCE.EVERYONE * GRUP.SUPER_GROUPS_DATASOURCE.AUTHENTICATED_USERS * ROLE: ROLE.PCD_ROLE_PERSISTENCE.VvlvkEGjiW9zPFaxR/4pd2/bX5Q= * ROLE.UME_ROLE_PERSISTENCE.un:SAP_JAVA_SUPPORT * ROLE.PCD_ROLE_PERSISTENCE.X0i/uUhhjJXOYQyzAkx5hpvh5CQ= * "com.sap.security.core.usermanagement"|->"lastname" (no time limit)="nath" * "com.sap.security.core.usermanagement"|->"accessibilitylevel" (no time limit)= * "com.sap.security.core.usermanagement"|->"locale" (no time limit)= * "com.sap.security.core.usermanagement"|->"uniquename" (no time limit)="sep_amar" * "com.sap.security.core.usermanagement"|->"firstname" (no time limit)="amar" * "com.sap.security.core.usermanagement"|->"email" (no time limit)= * "com.sap.security.core.usermanagement"|->"salutation" (no time limit)= * "com.sap.security.core.usermanagement"|->"displayname" (no time limit)= * "com.sap.security.core.usermanagement"|->"company" (no time limit)= * "com.sap.security.core.usermanagement"|->"APPROVAL_REQUEST_COMPANYID" (no time limit)= * "$serviceUser$"|->"SERVICEUSER_ATTRIBUTE" (no time limit)= * "http://sapportals.com/xmlns/cm"|->"PortalFavoritestH90zpQXu8M9/O7OZG+UO8iYi90=" (no time limit)= * "com.sap.portal.dsm"|->"DebugControlFlag" (no time limit)= * "com.sap.tc.webdynpro"|->"debugParameters" (no time limit)= * "com.sapportals.portal.navigation"|->"uipmode" (no time limit)= * "com.sap.portal.aidebug"|->"AppIntegratorDebugMode" (no time limit)= ***************************************************************************

Kindly let me knw how could i solve this poroblem

Thanks & Regards,

Amarnath S

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

IUser returns the entire user details. To get his name alone, try to use iuser.getUniqueName() and print it.

Check this for other methods on IUser.

https://help.sap.com/javadocs/NW04S/current/se/com/sap/security/api/IUser.html

Regards,

Harini S

Former Member
0 Kudos

Hi,

Try this code, ihad already used this code in my application......

public com.sapportals.portal.security.usermanagement.IUser getep5User() {

/*Getting the ep5user/

IWDClientUser wdClientUser = null;

com.sap.security.api.IUser sapUser = null;

com.sapportals.portal.security.usermanagement.IUser ep5User =null;

IResourceContext resourseContext = null;

try {

wdClientUser = WDClientUser.getCurrentUser();

sapUser = wdClientUser.getSAPUser();

//create an ep5 user from the retrieved user

sapUser = wdClientUser.getSAPUser();

ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);

/*End of Getting the ep5user/

} catch (Exception e) {

}finally{

try{

wdClientUser = null;

sapUser = null;

resourseContext = null;

}catch(Exception e){

}

}

return ep5User;

}

May this will help you.....:)

Regards,

Deepak

Former Member
0 Kudos

Hi Deepak,

Wat is ep5user?

Harini, as per uyor suggestion i used getUniquName(0, even thoghut i m getting the same error.... here below is the error.....

  • com.sap.security.core.persistence.imp.PrincipalDatabag Mon Apr 21 11:49:59 IST 2008 * UniqueID: USER.PRIVATE_DATASOURCE.un:sep_amar * Type: USER * Home data source: PRIVATE_DATASOURCE * Private id part: un:sep_amar * * Existence not checked. * * "com.sap.security.core.usermanagement"|->"j_authscheme" (no time limit)="basicauthentication" * "com.sap.security.core.usermanagement"|->"MYSAPSSO2_STRING" (no time limit)="AjExMDAgAA9wb3J0YWw6c2VwX2FtYXKIABNiYXNpY2F1dGhlbn... (total length: 468 characters)" *************************************************************************** Persistent data: *************************************************************************** * com.sap.security.core.persistence.imp.PrincipalDatabag Mon Apr 21 11:49:59 IST 2008 * UniqueID: USER.PRIVATE_DATASOURCE.un:sep_amar * Type: USER * Home data source: PRIVATE_DATASOURCE * Private id part: un:sep_amar * * Principal exists. * * Direct parents: * GRUP: GRUP.SUPER_GROUPS_DATASOURCE.EVERYONE * GRUP.SUPER_GROUPS_DATASOURCE.AUTHENTICATED_USERS * "com.sap.security.core.usermanagement"|->"lastname" (no time limit)="nath" * "com.sap.security.core.usermanagement"|->"accessibilitylevel" (no time limit)= * "com.sap.security.core.usermanagement"|->"locale" (no time limit)= * "com.sap.security.core.usermanagement"|->"uniquename" (no time limit)="sep_amar" * "com.sap.security.core.usermanagement"|->"firstname" (no time limit)="amar" * "com.sap.security.core.usermanagement"|->"email" (no time limit)= * "com.sap.security.core.usermanagement"|->"salutation" (no time limit)= * "com.sap.security.core.usermanagement"|->"displayname" (no time limit)= * "com.sap.security.core.usermanagement"|->"company" (no time limit)= * "com.sap.security.core.usermanagement"|->"APPROVAL_REQUEST_COMPANYID" (no time limit)= * "com.sapportals.portal.navigation"|->"uipmode" (no time limit)= * "$serviceUser$"|->"SERVICEUSER_ATTRIBUTE" (no time limit)=

Edited by: amar nath on Apr 22, 2008 8:15 AM

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi Amarnath,

Try using the following piece of code.

IWDClientUser wdUser = WDClientUser.getCurrentUser();

IUser user = wdUser.getSAPUser();

if(user != null){

IUserAccounts[] acct = user.getUserAccounts();

if(acct[0] != null){

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

}

......

}

else{

// code for anonymous user

}

Regards, Suresh KB

Former Member
0 Kudos

Hi,

What is the problem? I don't see any exceptions. The result string that you have posted looks like the output of the reportSuccess call in your code.

Regards,

Satyajit.

Former Member
0 Kudos

sorry, here below is the exception i m facing....

  • com.sap.security.core.persistence.imp.PrincipalDatabag Mon Apr 21 10:46:51 IST 2008 * UniqueID: USER.PRIVATE_DATASOURCE.un:sep_amar * Type: USER * Home data source: PRIVATE_DATASOURCE * Private id part: un:sep_amar * * Existence not checked. * * "com.sap.security.core.usermanagement"|->"j_authscheme" (no time limit)="basicauthentication" * "com.sap.security.core.usermanagement"|->"MYSAPSSO2_STRING" (no time limit)="AjExMDAgAA9wb3J0YWw6c2VwX2FtYXKIABNiYXNpY2F1dGhlbn... (total length: 468 characters)" *************************************************************************** Persistent data: *************************************************************************** * com.sap.security.core.persistence.imp.PrincipalDatabag Mon Apr 21 10:46:51 IST 2008 * UniqueID: USER.PRIVATE_DATASOURCE.un:sep_amar * Type: USER * Home data source: PRIVATE_DATASOURCE * Private id part: un:sep_amar * * Principal exists. * * Direct parents: * GRUP: GRUP.SUPER_GROUPS_DATASOURCE.EVERYONE * GRUP.SUPER_GROUPS_DATASOURCE.AUTHENTICATED_USERS * ROLE: ROLE.PCD_ROLE_PERSISTENCE.VvlvkEGjiW9zPFaxR/4pd2/bX5Q= * ROLE.UME_ROLE_PERSISTENCE.un:SAP_JAVA_SUPPORT * ROLE.PCD_ROLE_PERSISTENCE.X0i/uUhhjJXOYQyzAkx5hpvh5CQ= * "com.sap.security.core.usermanagement"|->"lastname" (no time limit)="nath" * "com.sap.security.core.usermanagement"|->"accessibilitylevel" (no time limit)= * "com.sap.security.core.usermanagement"|->"locale" (no time limit)= * "com.sap.security.core.usermanagement"|->"uniquename" (no time limit)="sep_amar" * "com.sap.security.core.usermanagement"|->"firstname" (no time limit)="amar" * "com.sap.security.core.usermanagement"|->"email" (no time limit)= * "com.sap.security.core.usermanagement"|->"salutation" (no time limit)= * "com.sap.security.core.usermanagement"|->"displayname" (no time limit)= * "com.sap.security.core.usermanagement"|->"company" (no time limit)= * "com.sap.security.core.usermanagement"|->"APPROVAL_REQUEST_COMPANYID" (no time limit)= * "$serviceUser$"|->"SERVICEUSER_ATTRIBUTE" (no time limit)= * "http://sapportals.com/xmlns/cm"|->"PortalFavoritestH90zpQXu8M9/O7OZG+UO8iYi90=" (no time limit)= * "com.sap.portal.dsm"|->"DebugControlFlag" (no time limit)= * "com.sap.tc.webdynpro"|->"debugParameters" (no time limit)= * "com.sapportals.portal.navigation"|->"uipmode" (no time limit)= * "com.sap.portal.aidebug"|->"AppIntegratorDebugMode" (no time limit)=