on 07-12-2005 2:16 PM
hi,
i need to gain access to all sap portal users from webdynpro. does somebody know, where the user information is stored?
thanks a lot in advance,
matthias
ps: scrolling a bit further down, i've got 2 other unanswered questions :-]
Try this
http://help.sap.com/saphelp_nw04/helpdata/en/0f/807300c5754ed79107dcd9c2ae4ef4/content.htm
WBR, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
If you are the J2EE instances of WAS and Portal are same then you can use the WDClientUser API to retrieve the user details
Code would be something like.
IWDClientUser user = WDClientUser.getCurrentUser();
wdComponentAPI.getMessageManager().reportSuccess("User is "+user.getSAPUser().getUniqueID());
Refer this thread for more information.
If the J2EE instances are different then you will have to write a Portal service that retrieves the name of the logged in Portal user and passes it as a return parameter. Now expose this portal service as a webservice and then consume the Webservice model in webdynpro.
Hope that was helpful
Regards
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi ravi,
in fact my portal and j2ee instances are the same, and I am using IWDClientUser to get the current user.
what i am aiming at is to get a list of all portal users. The link, Maksim gave (Portal Dev. Guide - searching for users...) seems to be promising...
I shall refer to this later on.
thanks anyway,
matthias
hi pablo,
sorry for the delay.
I am using the following imports:
import com.sap.security.api.IUser;
import com.sap.security.api.IUserFactory;
import com.sap.security.api.IUserSearchFilter;
import com.sap.security.api.UMException;
import com.sap.security.api.UMFactory;
to gain access to the list of all portalusers I use the following coding:
// get Portal User
IUserFactory ufact = UMFactory.getUserFactory();
IUserSearchFilter isf;
// ContextKnoten f�r Namen invalidieren und neu aufziehen
wdContext.nodeEPUser().invalidate();
try
{
isf = ufact.getUserSearchFilter();
// Provide the search attributes
isf.setUniqueName("*", ISearchAttribute.LIKE_OPERATOR, false);
// Start search
ISearchResult sr = ufact.searchUsers(isf);
String strtest = "";
String strnamen = "";
while (sr.hasNext())
{
//u = ufact.getUserByUniqueName(sr.next().toString());
//IUser iu = ufact.sr.next();
//strTest += "eintrag: "+u.getDisplayName()+", ";
strtest = sr.next().toString();
IUser user = UMFactory.getUserFactory().getUser(strtest);
// put user.getUniqueName().toUpperCase() in Context Node EPUsers
}
catch (UMException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
//System.out.println(e.getMessage());
}
Surely you get along with that,
regards Matthias
ps: the links provided above by others are indeed helpful.
esp this hint: http://help.sap.com/saphelp_nw04/helpdata/en/0f/807300c5754ed79107dcd9c2ae4ef4/content.htm
brought the solution for which I assigned 10 points
Message was edited by: matthias kasig
Hello Matthias,
Sorry annoyance but I hope you can help me.
I have problem with my UserSearch function in WenDinpro application and used your solution. But in my case without result.
try {
IUserFactory iuf = UMFactory.getUserFactory();
IUserSearchFilter usf = iuf.getUserSearchFilter();
// Input field for search parameter
String search = wdContext.currentContextElement().getUserDataSelect();
search = "" + search + "";
//Provide the search attributes
usf.setDisplayName(
search,
ISearchAttribute.LIKE_OPERATOR,
false);
//Start search
ISearchResult sr = iuf.searchUsers(usf);
String strtest = sr.toString().toUpperCase();
IUser user = UMFactory.getUserFactory().getUser(strtest);
// put to context
} catch (UMException e) {
e.printStackTrace();
}
I don't why I haven't access to user data (IUser user is blank). Can you help me?
best regards,
Natalia
Hello Natalia,
SearchResult is kind of Iterator, so it is not correct to call toString method to get user ID.
Try Matthias`s suggested code:
while (sr.hasNext())
{
strtest = sr.next().toString();
IUser user = UMFactory.getUserFactory().getUser(strtest);
...
}
Best regards, Maksim Rashchynski.
User | Count |
---|---|
87 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.