cancel
Showing results for 
Search instead for 
Did you mean: 

to get all the groups of the portal

Former Member
0 Kudos

Hi Everyone,

In our application, we need to get all the groups of the portal in a drop down menu through web dynpro java.

Please help me through this.

Thanks,

Shubham

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear Shubham,

You will need to develop a Portal component to do that.

First, here's the JAVA code to get your groups.

It would be something similar to this:



//==============get logged in user
try {
String userId = WDClientUser.getCurrentUser().getSAPUser().getUniqueName();

} catch (WDUMException e) {
msgmgr.reportException(e.getMessage(), true);
}

//============pass that user and access the group information==========
IUserFactory userFact=UMFactory.getUserFactory();

IUser ume_user;
try {

ume_user = userFact.getUserByLogonID(userId);
Iterator groups = ume_user.getParentGroups(true);
while (groups.hasNext()) {
String groupstr = (String) groups.next();
com.sap.security.api.IGroup g = UMFactory.getGroupFactory().getGroup(groupstr);

}
} catch (UMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

Then you need to create the drop-down to show you all those groups.

I suggest you use HTMLB to achieve that.

The following link explains you to do that:

[http://www.sapdesignguild.org/resources/htmlb_guidance/index.html]

There's a great example there with source code on how to use the object dropdownListBox

You can also check this great post:

[/thread/863974 [original link is broken];

It tels you how to display Portal Users List in HTMLB Dropdown List

(but of course you will need to adapt the solution to your specific needs)

Kindest Regards

/Ricardo Quintas

Former Member
0 Kudos

Hi Ricardo,

Thanks for the prompt reply. The code which you have send is for obtaining the groups of the logged user. What I need for my application is that I need all the groups of the portal i.e. all the groups of all the portal users. in the drop down.

Thanks,

Shubham

Former Member
0 Kudos

Hi,

As far as I know, you can only search for groups in portal using the code.

http://help.sap.com/saphelp_nw73/helpdata/en/c1/de99007c2a44cba904830e6cb85b41/content.htm

Why do you need to list down the portal groups ?

Best Wishes

Idhaya R

former_member40425
Contributor
0 Kudos

Hi,

You can use following code to get all available groups in Portal.


						IGroupFactory grpFactory = UMFactory.getGroupFactory();
			IGroupSearchFilter grpfilter = grpFactory
					.getGroupSearchFilter();

			grpfilter.setSearchAttribute(IPrincipal.DEFAULT_NAMESPACE,
					IPrincipal.DESCRIPTION, "*",
					ISearchAttribute.LIKE_OPERATOR, false);

			ISearchResult search = grpFactory.searchGroups(grpfilter);
			while (search.hasNext()) {

				String groupName = (String) search.next();
				IGroup group = grpFactory.getGroup(groupName);

				wdComponentAPI.getMessageManager().reportSuccess(
						"Group Unique name " + group.getUniqueName());
			}

After setting these groups in node you can bind it with your DropDown.

I hope it hepls.

Regards,

Rohit

Answers (1)

Answers (1)

Former Member
0 Kudos

Check the UME api, youwill be able to figure it out.

UME API provides all these features.

Start from the com.sap.security.api.UMFactory class