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 WebApi on logg...
Power Pages
Unanswered

Portals WebApi on logged in user field

(0) ShareShare
ReportReport
Posted on by 117

Is it possible when doing a query for a table, to get only the results of the current user?

 

What I have now is the Contacts table has a column, can I make so if I query X table, I want to show only the results where some X table column = that Contacts column.

 

I know I can filter them using $filter, but if someone looks in the networks tab, can remove that filter and access all entries of the table.

Categories:
I have the same question (0)
  • domliu37 Profile Picture
    314 Super User 2024 Season 1 on at

    Hi @sweb ,

     

    On Power Pages you can use Liquid object to get logged in user Id: {{ user.id }}

     

    So in your quesy (assuming is fetchQuery, simply just add

    <condition attribute="yourContactFieldSchemeName" operator="eq" value="{{ user.id }}" />

    ----------------------
    If you enjoy this post, click the thumbs-up button. If it helped you, mark it as a solution so others can find it easily.

    Cheers,
    Dom

  • sweb Profile Picture
    117 on at

    Hi @domliu , problem is on the table I want to query I don't have a column with user.id. That table it's a virtual table, actually and SQL table on another server

  • Fubar Profile Picture
    8,365 Super User 2025 Season 2 on at

    The Web API will obey the Table Privilege's of the logged in User - so you would need to tighten the privileges such that the data that could get exposed is scoped the Contact etc.

    (I always say never set Global privileges on the portal unless it is for things like types and categories or you absolutely have to, because if the Web API ends up getting enabled on the Table that holds 'private' info it can open a security hole )

  • EmadBeshai Profile Picture
    806 Moderator on at

    Hi @sweb ,

     

    If you well prepared the table permissions for this table don't worry about the filter, actually you shouldn't add filter against the current user because the Power Pages by default is doing that.

     

    All what you need is adding the contact on the table you want to retrieve the records from and configure the table permissions for this table as shown at the below link then don't worry about anything else you have done.

     

    Set table permissions in Power Pages | Microsoft Learn

     

    If this post helps you with your problem, please mark this answer as Accepted Solution.
    If you like my response, please give it a Thumbs Up.

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 78 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 75

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard