Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
Dynamic portal role assignment can be used to change the roles that a user has depending on some of their user details, providing, for example, a different menu structure for German speakers and English speakers. This is not the same as just translating the role menu into different langauges, as this assumes the same options regardless of language.

The following code can be used as a template for this type of assignment. I have kept this one simple, by assigning a role for English speakers and another one for non-English speakers.

An iView on the main portal home page would invoke this portal component, which works out whether any role assignments or deassignments are required. For example, if a user has changed their language from English to a non-English selection, we need to remove the English role and add the non English role. If any roles have been assigned or deassigned, then we force a re-logon to the portal by setting the top window to the URL for the portal.

Let's start with some header stufff..

Now some hardcoded role names and some controlling booleans and some details about the current user:

Now the main processing. We check which roles we currently have and assign any new ones and remove any old ones. We set a flag, restart, if we have made changes...

The restart flag decides whether we should set the top window to be our normal portal URL. This will cause the menu structure for the new roles to be displayed...

4 Comments