on 2006 Oct 17 3:09 PM
Hi,
I want to get the user ID details. I used this code and it provides me with the user id: name.surname
But from this I want to get the alias what shoud i add
try
{
IWDClientUser wdUser = WDClientUser.getCurrentUser();
IUser user = wdUser.getSAPUser();
if (user != null)
{
IUserAccount[] acct = user.getUserAccounts();
if(acct[0] != null)
{
String strUserid = acct[0].getLogonUid();
String strPasswd = acct[0].getHashedPassword();
IWDLabel myLabel = (IWDLabel)view.getElement("testLabel");
myLabel.setText(strUserid);
}
}
}
catch (Exception ex) {
ex.printStackTrace();
}
Hi,
First you need to add the security.api.jar file.
Procedure:
1. Right click on project name >properties>java buildpath>Libraries>add variables>ECLIPS HOME>Extend> Plugins->com.sap.security>lib>com.sap.security.api.jar -->order and export.
Write the below code in wddoinit()method for getting the portal logon user details .
Create one or two context elements and bind it with UI elements.
try {
String firstName = WDClientUser.getCurrentUser().getFirstName();
String lastName = WDClientUser.getCurrentUser().getLastName();
String name = firstName + " " + lastName;
wdContext.currentContextElement().setUserName(name);
ISearchResult rst = UMFactory.getUserFactory().getUniqueIDs();
IUser iuser = null;
while (rst.hasNext()) {
iuser = UMFactory.getUserFactory().getUser(rst.next().toString());
if ((firstName.equalsIgnoreCase(iuser.getFirstName())) & (lastName.equalsIgnoreCase(iuser.getLastName()))) {
String emailId = iuser.getEmail();
wdContext.currentContextElement().setEmailid(emailId);
}
}
} catch (WDUMException e) {
e.printStackTrace();
} catch (UMException ue) {
ue.printStackTrace();
}
//@@end
}
Regards,
Saraswathi.
Pls reward points for useful information
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Eoin,
Check
https://media.sdn.sap.com/javadocs/NW04/SPS15/um/com/sap/security/api/IUser.html
https://media.sdn.sap.com/javadocs/NW04/SPS15/um/com/sap/security/api/IPrincipal.html
What is alias? I can only see IPrincipal.getDisplayName wich is <i>Gets the principal's display name. Depending on the implementation, this might be an alternative (<b>alias</b>) name</i>.
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
70 | |
10 | |
10 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.