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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / user.roles liquid enti...
Power Pages
Answered

user.roles liquid entity returns all authenticated web role, instead of user's roles.

(1) ShareShare
ReportReport
Posted on by 96

I tried to show/hide a part of a site based on user's assigned web roles with the following liquid code, when I saw this anomally described in the title:

      {% assign manager= user | has_role: 'Manager' %}
      {% if manager %}
      {% include 'entity_list' key: 'Manager' %}
      {% for view in user.roles %}
      {{ view }}
      {% endfor %}
      {{user.fullname}}
      {% else %}
      {% include 'entity_list' key: 'employee' %}
      {% endif %}

If I write out webroles of user with liquid all roles are returned, not the actually assigned:

      {% for view in user.roles %}
      {{ view }}
      {% endfor %}
For testing I created a new web role, and that shows up in this list instantly, before any assign was made for contacts.
How it is possible?
Categories:
  • Verified answer
    rgx91 Profile Picture
    96 on at

    Setting Authenticated Users Role  to false in webrole solved the issue.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Pages

#1
Mohsin Ali Profile Picture

Mohsin Ali 35

#2
M Bilal Khan Profile Picture

M Bilal Khan 33

#3
11manish Profile Picture

11manish 21 Super User 2026 Season 2

Last 30 days Overall leaderboard