cancel
Showing results for 
Search instead for 
Did you mean: 

WDJ code not able to fetch the user from LDAP

Former Member
0 Kudos

Dear Experts,

I have written following code to fetch the portal user in my WDJ. This code works fine for the Users in UME database but for LDAP user i am not getting the desired result.

try {

String str_ID = wdContext.currentContextElement().getUser_ID();

ISearchResult rst = UMFactory.getUserFactory().getUniqueIDs();

IUserFactory usf = UMFactory.getUserFactory();

IUser iuser = null;

int i = 0;

boolean found = false;

while (rst.hasNext()) {

iuser = UMFactory.getUserFactory().getUser(rst.next().toString()); String uID = iuser.getUniqueName();

if(uID.equals(str_ID)) {

wdComponentAPI.getMessageManager().reportSuccess(uID);

found = true;

break;

}

}

if(found) {

wdComponentAPI.getMessageManager().reportSuccess("Hahahaha.....User Found");

} else {

wdComponentAPI.getMessageManager().reportSuccess("User Does Not exists");

}

} catch (Exception e) {

wdComponentAPI.getMessageManager().reportException(e.getMessage(), true);

}

Please help..

Thanks in Advance.

Regards,

M.D.Sahu

Accepted Solutions (1)

Accepted Solutions (1)

former_member214651
Active Contributor
0 Kudos

Hi,

Try the following code:

String userName = WDClientUser.getCurrentUser().getSAPUser().getName();

Note: - Please add com.sap.security.api.sda as a dependency to ur DC which will be under the ENGINE-API SC

refer the links below:

/thread/229842 [original link is broken]

Regards,

Poojith MV

Former Member
0 Kudos

Thanks for your quick reply.

Sorry to say but I am not very much clear about where should i put the above code in my prg.

Actually In my Portal more than 2 LDAPs are connected and by giving the User ID in my WDJ applicaiton i wanted to know from which LDAP the user belongs to. To achieve this i wanted to process every userID in the both the LDAP and compare the user user given ID with it.Please let me know if anything is not clear.

Thanks,

M.D.Sahu

p330068
Active Contributor
0 Kudos

Hi M.D.Sahu

Please refer the [Wikki -1|http://wiki.sdn.sap.com/wiki/display/WDJava/Check%2ball%2bUsers%2bwho%2bhave%2blogged%2binto%2bportal%2b-%2bwebdynpro%2bappl] amd [Wikki - 2|http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=16442] and [Blog |http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/1789] [original link is broken] [original link is broken] [original link is broken]; to accomplish your requriement.

Hope it will helps

Regards

Arun Jaiswal

Answers (0)