cancel
Showing results for 
Search instead for 
Did you mean: 

IUser in Web Dynpro

Former Member
0 Kudos

Hi,

I'm just developing a web dynpro to analyze folder structures in km. Now I want to create an IResource object. For this I need the current User (com.sapportals.portal.security.usermanagement.IUser).

How can I get the User? I looked for such method in wdThis. But I didn't found anything.

Regards,

Gerhard

Accepted Solutions (1)

Accepted Solutions (1)

roberto_tagliento
Active Contributor
0 Kudos

/thread/235656 [original link is broken]

better

/people/rohit.radhakrishnan/blog/2005/05/27/uploading-files-to-km-repository-using-webdynpro-apis

Message was edited by:

Roberto Tagliento

Answers (3)

Answers (3)

Former Member
0 Kudos

hi

Try this

�� Searching for UME objects consists of:

1. Creating a search filter from the UserFactory

2. Setting the Search Attributes for the search

3. Invoking the search

4. Iterating through the search result

�� The result of the search is of type ISearchResult and returns an

iterator containing the UniqueIds of the principals returned

�� The search result also contains the state of the search:

SEARCH_RESULT_INCOMPLETE

SEARCH_RESULT_OK

SEARCH_RESULT_UNDEFINED

SEARCH_RESULT_EXCEEDED

TIME_LIMIT_EXCEEDED

Searching for Users

IUserFactory userFact = UMFactory.getUserFactory();

IUserSearchFilter userFilt = userFact.getUserSearchFilter();

userFilt.setLastName("Sm?th*");

ISearchResult result = userFact.searchUsers(userFilt);

if (result.getState() == ISearchResult.SEARCH_RESULT_OK) {

while (result.hasNext()) {

String uniqId = (String) result.next();

IUser thisUser = userFact.getUser(uniqId);

String name = thisUser.getDisplayName();

...

}

} else {

// print error or warning

}

Returns UniqueID of user

Use the UniqueID to obtain an instance

Please import com.sap.security.api.*;

Regards

Nidhideep

GSL_NARAYANA
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Gerhard,

To get the current portal user use com.sap.security.api.jar

String strUserID = null;

try{

IWDClientUser wdUser = WDClientUser.getCurrentUser();

IUser user = wdUser.wdUser.getSAPUser();

if(user !=null)

{

IUserAccount[] act = user.getUserAccounts();

if(act[0] != null)

{

strUserID = act[0].getLogonUid();// holds the current portal ID

}

}

}catch(Exception e)

{

}

Hope it helps.

Regards,

Lakshminarayana

Former Member
0 Kudos

Hi Gerhard

U need to add com.sap.security.sda in your java build path.

And then you'll get IUser interface.

Thanks

Srikant