In an XPiNC app, how can I launch one XPage vs. another based on Role

258 Views Asked by At

I have an XPiNC app that consists of two different XPages. The XPages are set up to be used based on Roles. One Role is for the people who set up the content and the other is for those that consume it.

One of my requirements is that the Consumer Role wants to open the NSF from the desktop and have it automatically open the Consumer XPage. I know I can set the Launch property to do this for the Consumers, but that also causes the Content Providers to open that XPage which is not what should happen.

How can I set it up so that the application opens to the proper XPage based on their Role?

3

There are 3 best solutions below

3
On BEST ANSWER

Another way to do this would be to have a third page which is the launch page. This page would just have a beforePageLoads event that looks at the user roles and then does a context.redirectToPage("/otherpage.xsp") depending on the role detected.

2
On

The Include Page component (<xp:include />) supports a pageName attribute which can be computed. If you set your launch page to an XPage that consists only of a <xp:include />, and compute pageName based on user roles (e.g. context.getUser().getRoles().contains("[Consumer]") ? "/consumer.xsp" : "/index.xsp"), then what the user actually sees will be role-dependent.

0
On

I know this has been answered, but for my benefit. Would you be able to have 1 xpage and then load a custom control dynamically based on the role?