cancel
Showing results for 
Search instead for 
Did you mean: 

Obtaining the current role in a web dynpro application

Former Member
0 Kudos

Hi All,

Please let me know a way to find out the current portal role from a web dynpro application. The scenario is like this, lets say I'm having a sample web dynpro application TestApp. Now this application is available under four portal roles Role A, Role B, Role C and Role D. Now whenever the application is being accessed through one of these four roles, I have to fetch the role and show the respective data. I hope this would give you a clear picture of the issue. Looking for some quick response.

Thanks in advance,

Ganpati Jha

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

We can use the following API to get the current role:

IWDNavigationHelperService wdNavHelperService =

(IWDNavigationHelperService) WDPortalUtils.getService(IWDNavigationHelperService.KEY);

String navNode = wdNavHelperService.getCurrentNavNode();

Regards,

Ganpati

0 Kudos

You can check if current user is member of role.

import the com.sap.security.api

then extract the IUSER

IWDClientUser wdClientUser = WDClientUser.getCurrentUser();

com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();

then check if is member of role

IRole theGroupcom = UMFactory.getRoleFactory().getRoleByUniqueName(<yours>);

finally

if (user.isMemberOfRole(theGroupcom.getUniqueID(),false)) ecc ecc

Bye.