Tutorial: Display data securely on your site

In the previous tutorial, you added a list to a page; however, users wouldn't be able to view any data. Power Pages has security enabled by default to protect your business data. This tutorial will walk through the steps to create table permissions and associate them to web roles to allow visitors to your site to be only able to interact with the information that you allow.

In this tutorial, you learn how to:

  • Create table permissions
  • Set access type and privileges
  • Add web roles

Prerequisites

Create table permissions

This video provides an overview of the steps to create table permissions.

Use the steps below to learn how to configure table permissions to view data.

  1. Go to Power Pages.

  2. In the pages workspace on the page where you have a list component, select the component and choose the Permissions button.

  3. Select New table permissions.

  4. Give table permission a name.

  5. Select a Dataverse table.

  6. Set the access type to Global.

  7. Set the permissions to Read.

  8. Choose Anonymous and Authorized user for the web roles.

    Create a table permission.

  9. Now that table permissions are set, view the page by selecting Preview.

  10. You should now see a list of Dataverse records on the page.

Note

You can give the table permission any name, but ideally it should be descriptive.

Set access type and privileges

When you configure a list or a form in Power Pages, by default your users won't have access to the information in Dataverse. There are instances where you would want to limit what data a particular set of users. This can be done with a combination of table permissions and security roles.

If your table in Dataverse has a relationship with a Contact or Account table, you can filter the records based on that relationship.

In the example below, we've created a table that has a lookup to the contact table.

This video provides an overview of the steps to set access types and privileges.

  1. Create a page with a list showing records that have a relationship to the contact table.

    Note

    Go to Tutorial: Add list to a page for details on how to a list to page. Create a table with a lookup to the contact table.

  2. From the list on the page, choose on the Permission button.

  3. Select to create a new table permission.

  4. Give the table permission a name and choose Table.

  5. Select Access type Global access.

  6. Set permissions to Read.

  7. Assign the Table permission to the Authenticated user web role.

  8. Select Save.

    Create a table permission for table with contact lookup.

  9. Preview the site and sign-in. For purposes of this tutorial, you can sign in using Microsoft Entra ID.

  10. View the page on the site. When any user signs in, they should see all the data in the table.

    Logged in user viewing all data on a page.

  11. In our example, we would only want to show records that related to the currently signed-in user. Return to the design studio, select the list on the page and select permissions.

  12. Modify the existing table permission and change the Access Type to Contact Access.

  13. You'll need to specify the relationship between your table and the contact table.

    Note

    If you don't see a relationship, you will need to define a lookup to the contact table using the Data workspace. Create or update some records that are related to the contact record you are using to sign-in to the site.

    View a table that is filtered by the currently signed in user.

  14. Preview the site and sign-in. You now should only see records that are related to the contact that has signed in to the site.

    List view only showing related records.

More information

There are several different access types and privileges in Power Pages.
For more information, see:

Add web roles

In our examples so far, we've assigned the table permissions to the default Authenticated Users and Anonymous Users web roles.

This video provides an overview of using web roles.

We can also create our own custom web roles to further limit access to data and pages to certain site visitors.

  1. In the design studio, select the ellipses ... from the side menu and select Portal Management to open the Portal Management app.

  2. In the Portals Management app, under the Security section, select and view Web Roles.

  3. Select New to create a new web role and give it a descriptive name. Leave the Authenticated Users and the Anonymous Users roles set to No.

    Create web role.

  4. Save the web role record.

  5. Select Related and choose Contacts. Select Add existing contacts choose a few contacts.

    Add contacts to web role.

    Note

    Site users are stored as Contacts records.

  6. Within the design studio on a list or a form, choose the permissions button and select a table permission, then assign the custom web role.

    Assign the student web role.

    Note

    You'll need to restart the design studio or clear the browser cache (ctrl + F5) to see the new web role.

  7. Preview the site and note that only users logged in will be able to view the data on a form or list.

Next steps

Showing data in a list view to the correct audience is an important feature of Power Pages. The next tutorial will cover adding a form to a page to allow users to create and edit business data.