on 08-07-2007 7:21 AM
Hi,all
In NW 2004 I retrieved the user name of portal user by following:
HttpServletRequest req =((com.sap.tc.webdynpro.services.sal.adapter.core.IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter ()).getHttpServletRequest();
wdContext.currentContextElement().setUserName(req.getRemoteUser());
But in NW 2004S it is not working.I can not to locate IWebContextAdapter.
How can I retrieve the portal user name here?
Regards,
Michael
Hi,
Please try following code and let me know.
-
import com.sap.tc.webdynpro.services.sal.um.api.IWDClientUser;
import com.sap.tc.webdynpro.services.sal.um.api.WDClientUser;
try
{
//get the currently logged in user
IWDClientUser wdUser = WDClientUser.getCurrentUser();
//get the com.sap.security.api.Iuser; It is null in case wdUser represents an anonymous user
IUser user = wdUser.getSAPUser();
//check whether the user is anonymous
if (user != null)
{
//access logon ID by iterating through the IUserAccount array
IUserAccount[] acct = user.getUserAccounts();
if(acct[0] != null)
{
String strUserid = acct[0].getLogonUid();
wdContext.currentContextElement().setId(strUserid);
//pass the value obtained from the portal to value attribute
}
}
}
catch (Exception e)
{
wdComponentAPI.getMessageManager().reportException("Failed to get current user: " + e.getLocalizedMessage(), true);
}
-
Regards,
Vaibhav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michael
WDClientUser.getCurrentUser().getClientUserID();
Regards
Abhimanyu L
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this:
WDClientUser.getLoggedInClientUser().getFirstName();
Regards,
Satyajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.