cancel
Showing results for 
Search instead for 
Did you mean: 

How to Gets a Portal User Group through Web Dynpro JAVA Application

Former Member
0 Kudos

Hi Friends

I have one doubt in UME. How to Gets a Portal User Group through Web Dynpro JAVA Application. Could you tell me that Codeing.

What is the Process.

Here my Req is Depending upon portal user group I can disable button in WDJ Appliactions after finally that we will send out put in Portal.

So depending upon user groups will seen only Search and Download Button remaining button in Disable mode

Remaining user groups will seen all button in WDJ Applications. Those button are search, Download, confirmPO, Change Date and Quantity like etc.

1. How we will get the User group in WDJ Application.,

2. where we will write this code in Views. In wdinit() method or any another method.

3. How we will disable buttion depending upon user group.

Regards

Vijay Kalluri

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Vijay,

1. How we will get the User group in WDJ Application.,

there is one method in the UME API to check wether the user belongs to the group or not for this


IUser user = WDClientUser.getCurrentUser().getSAPUser();

boolean result = user.isMemberOfGroup(<uniqueIdOfGroup>, true) ;

here based upon the boolean you can maintain the Buttons.

You can write this code in the doinit method.

Take an attribute of type boolean for controlling the button. Bind the UI element property of the button to Context and change the context variable based on the result.

Thanks,

Raju Bonagiri

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi ,

You can use the following code for accessing Group info of login user.

//==============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();

}

Regards

Trilochan

MichaelShea
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Vijay,

Why don't you create a Java permission that enables the Search and Download Button and then only assign that permission to the group you want. Has the advantage that you can flexibly change what group or groups can use this authorization without touching your code and there are surely plenty of examples of how to program this.

-Michael