cancel
Showing results for 
Search instead for 
Did you mean: 

Reading a user's role in Dynpro

Former Member
0 Kudos

I am currently writing an application in Dynpro / java that will eventually run on EP6.

This application will allow external product distributors to enter sales information and view their history / performance. A distributors access will be quite limited in that they will only be able to see their own sales data.

In addition, the site will be accessed by internal employees who will have a much wider range of functions available to them. They will be able to view performance statistics for all distributors by region and see internal costing sales figures.

Rather than maintain roles within the program, or worse yet, maintain two separate applications, I would like to read a user's role within the portal environment and enable / disable functions in the application based on their role.

From what I have been reading it seems possible to obtain this information through the "getRoleFactory()" method in the UMFactory class but so far I haven't got it to work.

Has anyone had an practical experience obtaining role information from EP6 (in Dynpro preferably). Any information would be helpful at this point (a small code sample would be ideal).

thx

-Sheldon

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

IWDClientUser clientUser = WDClientUser.getCurrentUser();

IUser user=clientUser.getSAPUser();

if(user!=null){

user.****

}

maybe this will help

former_member182372
Active Contributor
0 Kudos

....

And use IUser`s method getRoles (https://media.sdn.sap.com/javadocs/NW04/SPS15/um/com/sap/security/api/IUser.html#getRoles(boolean)):

<i>

public Iterator getRoles(boolean recursive)Gets the list of (all) assigned roles of this user including parent groups, grandparent groups,... if recursive is set to true NOTE: This method may also return roles which are already deleted.

Parameters:

recursive - if true returns all parent roles

Returns:

iterator of roles for this principal. The iterator contains uniqueIdOfRole strings

</i>

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks to everyone that helped on this one. All answers were helpful in solving this.

Former Member
0 Kudos

Can you please give me your mail_ID, I have some files I can send you.

Thanks,

Raj.

Former Member
0 Kudos

Hi Sheldon,

I tried to send you the mail 1 hour ago. The mail delivary is failed. Give me your personal mail id not official.

/Raj.