cancel
Showing results for 
Search instead for 
Did you mean: 

Role used to access WDJ application

Former Member
0 Kudos

Hi Friends,

I have a Web Dynpro Java application deployed in our portal 731. This WD app will be accessed from role A, Role B, Role C. End User will be having all three roles assigned. Depending on the role selected, we have to fetch master data from our backend server.

In WD init (), how can we know which role is selected?

I have tried below code and it is listing all the roles assigned to the user and I am unable to track which role he has navigated(selected).

Code:

IUser currentUser = WDClientUser.getCurrentUser().getSAPUse();// identifying current loggedin user

Iterator<String> rolesAssignedToUser = currentUser.getRoles(true);// getting the role list assigened

I want to know from which role he is viewing the current app view and not the list of roles assigned to his user id.


Regards,

Rakesh Mathew

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor
0 Kudos

IWDNavigationHelperService wdNavHelperService =

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

      INavigationNode navigationNode = wdNavHelperService.getCurrentNavNode();

      String navNode = navigationNode.getName();

add tc/ep/navigation/api as dependency

Former Member
0 Kudos

Hi Jun,

Thanks it is worked. You saved lot of time.

Regards,

Rakesh

Answers (1)

Answers (1)

govardan_raj
Contributor
0 Kudos

hi Mathew ,

im not aware of finding out the current selected role at runtime , but one solution to your requirement is to have three different pages for role A, role B and role C , so that in the page you can maintain parameters which is accessible at runtime by using the code

WDProtocolAdapter.getProtocolAdapter().getRequestObject().getParameter(""); 

in the page ,. you have application parameter property there for role a -> page -> add parameter like

CurrentRole=A

and simillary in other pages at role b -> CurrentRole=B

rolec -> CurrentRole = C

in wdDoinit() methods you can use this.

 

String currentRoleSelected = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getParameter("CurrentRole");

make sure that CurrentRole parameter added in the page application parameters , will be case sensitive ,i.,e same name should be used at wdprotcol..... getparameter("parametername added in the page") 

Regards

Govardan Raj S

Former Member
0 Kudos

Hi Govardan Raj,

Yes.But in this case i need to create more than 40 pages. That's why i am checking alternative options (current selected role at run time). Thanks for the update.

Regards,

Rakesh