Skip to Content
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…

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. SUNIL HS
    Hi..I have successfully been able to assign roles dynamically using your method but I am not able to refresh the screen automatically. The script does not run, all I need is the user gets the roles upon login and the same should be visible. The user should not need to refresh screen manually.
    (0) 
    1. Michael Nicholls Post author
      Sorry, but I don’t have a PAR for this any more. My NWDS has been rebuilt a few times and I did not recreate this portal app.
      It should be fairly straight forward for you to build a new portal project etc.
      (0) 

Leave a Reply