on 08-19-2011 3:01 PM
Hello All,
I am writing a Webdynpro Java Application where I want to retrieve all the users who use the Portal . Our portal is connected to the LDAP server.
I know that I can get the current logged in user using the code below:
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
IUser sapUser = wdClientUser.getSAPUser();
Is there a way to get all the users the portal has, using Webdynpro Java.?
Any help would be highly appreciated.
Thanks.
what's your real requirement?
if you try to retrieve all user, it is likely to make your page hang.
Edited by: John Wu on Aug 24, 2011 6:54 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Take look at this example on how to retrieve all the users who are logged in the portal
http://wiki.sdn.sap.com/wiki/display/WDJava/CheckallUserswhohaveloggedintoportal-webdynproappl
Here is an overview of the UME API.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You may have to write the code to loop through the datasources, and get all the users associated with each datasource.
You can get datasource of a user by following code:
String[] datasources = umeUser.getAttribute(IPrincipal.DEFAULT_NAMESPACE, IPrincipal.DATASOURCE);
if(datasources[0].equals("CORP_LDAP")){
.........
}
Not sure if reverse is possible...
If Portal just uses LDAP as the only datasource, then you can get this list directly from LDAP (contact the LDAP admin).
Hope this helps.
Try this:
IUserFactory userfact = UMFactory.getUserFactory();
IUserSearchFilter sf = ufact.getUserSearchFilter();
sf.setUniqueName("*USER.CORP_LDAP.*", ISearchAttribute.LIKE_OPERATOR, false);
ISearchResult sr = userfact.searchUsers(sf);
while (sr.hasNext()) {
/*loop through all the users in LDAP*/
}
Hi
Use following to get all users.
IUserFactory uFactory = UMFactory.getUserFactory();
ISearchResult AllUserIds = uFactory.getUniqueIDs();
while (AllUserIds.hasNext()) {
String UserID = (String) AllUserIds.next();
IUser sapUser = uFactory.getUser(UserID );
if (sapUser.getUserAccounts()[0] != null) {
wdComponentAPI.getMessageManager().reportSuccess("Logon UID: " + sapUser.getUserAccounts()[0].getLogonUid());
}
}
I hope it helps.
Regards,
Rohit
Writing such a component may result in out-of-memory exception or the page might hang. Try this alternate way:
Search for all the groups (*) in LDAP (from All Data Sources dropdown) in UME. Select "Yes, show me the complete result." from the warning. Now click export and copy-paste this in a text file. Write a simple parsing program, that'll get the user list from this huge file.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.