cancel
Showing results for 
Search instead for 
Did you mean: 

how to access list of portal users

Former Member
0 Kudos

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 :-]

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Answers (1)

Answers (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

Hi Matthias,

if the no of client users is what you want; you might want to try this

WDServerState.getNumberOfClientUsers()

hope it helps.

Regards,

shyam.

Former Member
0 Kudos

interesting Object, but when i checked it, it produced something like an endless loop. Actually I need the No of Users and their LogonIDs.

the link provided by Maksim Rashchynski is very helpful.

thanks anyway,

Matthias

Former Member
0 Kudos

I'm looking for the exact same thing, where you able to bring the UMFactory from a WebDynpro application? For sure, you had to import some classes or connect to a DC... Pleas help

Thank you.

Former Member
0 Kudos

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

Former Member
0 Kudos

Perfecto, is working for me now ... Thank you.

natalia_kogan
Explorer
0 Kudos

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

former_member182372
Active Contributor
0 Kudos

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.