web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Portals - Navigation b...
Power Pages
Answered

Portals - Navigation based on web roles

(0) ShareShare
ReportReport
Posted on by 184

Hello

 

I have a self-service portal where external users and internal users can login. We have 2 web pages:

Web Page A - For external users

Web Page B - For internal users

 

When the 'Create Case' button is clicked in the below screen, I would like to show web pages depending on the user's web roles. So if external user clicks Create Case, it should navigate to Web Page A.

And if internal user clicks Create Case, it should navigate to Web Page B.

 

Vikram87_0-1610504688006.png

 

Could you suggest me the best approach for this please?

 

Thanks

Vik

 

Categories:
I have the same question (0)
  • Fubar Profile Picture
    8,346 Super User 2025 Season 2 on at

    You create "restrict read" Web Page Access Control rules (menu item in the Portal Management app) for your Web Pages and attach the rules to your web roles - it is a little different in the make.powerapps interface but same outcome see https://docs.microsoft.com/en-us/powerapps/maker/portals/configure/webpage-access-control

  • arjunmusuvathy Profile Picture
    184 on at

    @Fubar  Thanks for your reply. I have a question,

     

    If I setup the Web Page Access Control rule, what will the 'Create Case' button navigation be? As the navigation will be to one page only right?

  • oliver.rodrigues Profile Picture
    9,368 Most Valuable Professional on at

    In addition to @Fubar answer, the Web Page Access Control Rules will take care of hiding the "Authenticated Page" when the user is not yet signed-in, but not vice-versa. After a user signs-in they will still be able to view both links.

    I would recommend creating two different Web Link Set with a different group of links, and you can change the Header Web Template to show the appropriate Menu. 

    This is in addition to the Web Page Access Control Rules, I'd recommend combining both.

     

    I talk about this approach on a community call: https://youtu.be/ky4X7chwl1I?t=1276

     

  • arjunmusuvathy Profile Picture
    184 on at

    @OliverRodrigues  Thanks for this information.

     

    I have seen your video where you make changes to the header template.

     

    Say I created web link A and B to link to two different pages. In my case, can I know what will the liquid template code look like in header template for the below logic please? (especially looking for syntax of web role of user logged in)

     

    if (user' web role = XYZ)

      {% assign primary_nav = weblinks["A"] %}

    else if (user's web role = ABC)

      {% assign primary_nav = weblinks["B"] %}

     

     

    Thanks

    Vik

  • oliver.rodrigues Profile Picture
    9,368 Most Valuable Professional on at

    Hi, the example below has three menus - Admin / Authenticated / Anonymous, so that's how you validate the role:

     

     {% if user %}
     {% if user.roles contains 'Administrator' %}
     {% assign primary_nav = weblinks["Primary Navigation (Administrator)"] %}
     {% else %}
     {% assign primary_nav = weblinks["Primary Navigation (Authenticated)"] %}
     {% endif %}
     {% else %}
     {% assign primary_nav = weblinks["Primary Navigation (Unauthenticated)"] %}
     {% endif %}

     

    if you just need for Authenticated / Anonymous, then you don't need to check the role itself, all you need is the "{% if user %}" validation, just as I show in the video.

     

  • arjunmusuvathy Profile Picture
    184 on at

    Hi @OliverRodrigues 

     

    Many thanks for the code. 

     

    I have the below code setup in header, however when I login as a support user and access the page it takes me to the web link mentioned in the Administrator line below.

     

    {% if user.roles contains 'Administrator' %}
    {% assign primary_nav = weblinks["web link A"] %}

    {% else if user.roles contains 'Support' %}
    {% assign primary_nav = weblinks["web link B"] %}
    {% endif %}
    {% endif %}
     
    Could you let me know if I am missing anything please
     
    Thanks
    Vik
  • oliver.rodrigues Profile Picture
    9,368 Most Valuable Professional on at

    Hi, a few things you can check:

    • Review the Web Roles of your Contact record that you are signing-in - make sure the Admin web role is not there
    • Review your Web Link Sets (web link a / b) and review the links, perhaps add a very different (with different names) just to make it easier to identify with Web Link Set is showing in the Portals
    • Clear the cache
    • You can also display in the header the user roles Liquid object to check which roles the current user contains
  • Verified answer
    Fubar Profile Picture
    8,346 Super User 2025 Season 2 on at

    One thing to be aware of if doing the roles contains method just in the navigation, is that this will just swap the link set etc it does not securely stop the user from accessing the Web Page (this may or may not be an issue depending on your scenario) e.g. if the user knows what both URLs are of the pages they will be able to access both even though 1 is not displayed in the menu.  If security is an issue you need to further extend you customisation to create custom Templates and embed your logic in the template (e.g. if user role contains xyz show form etc else show error message).

     

    Note: I interpreted internal and external user as both being authenticated - if this is the case then the Web Access Control rule method is the more secure method.  If anonymous users then yes the authenticated user would also see the pages available to anonymous users (using Web Access Control rules).

     

  • oliver.rodrigues Profile Picture
    9,368 Most Valuable Professional on at

    that's a fair point by @Fubar if you only need to swap the links between different roles, then only the web page access control rules should do the job.

    if you also need to cater for an anonymous menu, I would recommend a combination of both

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 70 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 55

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard