on 08-20-2008 8:28 PM
Hi All,
Using the IWDClientUser and IUser classes, I am retrieving the portal logged in user name in web dynpro. But iam getting null pointer exception.
IUser sapUser = null; IWDClientUser user = WDClientUser.getCurrentUser();sapUser = user.getSAPUser(); String str = sapUser.getName();
Help required.
thanks
Supriya.
hi,
try with the following code,
String userid="";
try {
IWDClientUser user = WDClientUser.getCurrentUser();
userid = user.getSAPUser().getUniqueName();
}
catch (WDUMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Thanks,
ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
IWDClientUser wdUser;
try {
wdUser = WDClientUser.getCurrentUser();
IUser user = wdUser.getSAPUser();
if (user != null)
try {
{
IUserAccount[] acct = user.getUserAccounts();
if(acct[0] != null)
{
String strUserid = acct[0].getLogonUid();
//strUserid.get
}
}
} catch (UMException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
} catch (WDUMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
use the above code to get Logonid
To get the Roles, assigned to portal user
see the below link
https://forums.sdn.sap.com/thread.jspa?threadID=918585&messageID=5597028#5597028
Regards,
Sunitha Hari
Hi,
You can use the following cade...
String login;
IWDClientUser wdUser;
try {
wdUser = WDClientUser.getCurrentUser();
IUser user = wdUser.getSAPUser();
if ( user != null ){
try {
IUserAccount account = user.getUserAccounts()[0];
if(account != null){
login = account.getLogonUid();
String fname = user.getFirstName();
String lname = user.getLastName();
wdContext.currentLoginInfoElement().setFirstName(fname);
wdContext.currentLoginInfoElement().setLastName(lname);
}
} catch (UMException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
} catch (WDUMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The follwing lines of code would provide u the current user
IWDClientUser user = WDClientUser.getCurrentUser();
and the sap was user
IUser suser = user.getSAPUser();
to get the role
IRole role = UMFactory.getRoleFactory().getRole(roleName);
// check if user is member of role,
// the "true" attribute means, that role assignment might be
// indirect (ie. for a group in which user is a member
result =role.isUserMember(sapUser.getUniqueID(), true);
regards
Nihil tapkir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Venkata,
Make sure that sap.Authentication property of WD Application is set to true.
Try using the below code:
IWDClientUser user = WDClientUser.getLoggedInClientUser();
IUser puser = user.getSAPUser();
now you can get the name and other attributes.
Regards,
Siddharth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
i think you are getting Null pOinter exceptions because
Most possible case is you dont have the NAME field filled while creating the user in portal.
try getting the remaining fileds like (first name,last name,display name,etc.,,,,,,,,,,,,).
Thanks & Regards,
Lokesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
Can you check once again, i think your null pointer exception is at
String str = sapUser.getName();
if yes then
do as above post and use firstname lastname
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Are you logging into the portal to run your application? Is a guest user configured in the UME? The getSAPUser() call returns null if there's no guest user in the UME or it might return a named anonymous IUser instance.
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 |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.