on 09-12-2011 10:42 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
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.