Getting Started with PowerApp Portals & Dataverse Part 3: Permissions and Registration

This post has been republished via RSS; it originally appeared at: Microsoft Tech Community - Latest Blogs - .

Prior parts to the series:

Part 1:  We will look at setting up the PowerApps Environment, creating the database entities, and creating a view and form for a table.

Part 2:  Creating the Power Apps Portal, creating a new page, setting up the form to capture new rec...

 

Part 3: Permissions and Registration

 

Just a few more customization to bring it all together to see the final results.

 

Topics covered in this post:

  • Adding a “Created by Contact” column to your main table along with a relationship to the Contact table.
  • Configuring the Created by Contact column to automatically populate based on the logged in contact.
  • Update the view to filter on Created by Contact so that users only see records that they created.
  • Walk through registering on your Portal and where that registration record gets created.
  • Assigning Contacts to the Web Role so that they can see the page. 

 

Setting up an auto populated contact field

 

Step 1: Create the Contact column.

Open the table that has a view and form that was created.  Add a new “Contact” column to capture the Portal user that is creating the database entry.  This field is required to limit the records that a portal user has access to view and potentially edit.

  • DataType: Lookup
  • Related table: Contact 
    Note: A relationship will be created between this table and the Contact table.

    DaveUpton_0-1643396988979.png

 

Step 2: Create a metadata entry to auto populate the contact field based on the Portal user

 

Creating a filtered view based on a specific contact requires a contact field to be populated.  To populate that field at the time of record creation, requires a metadata field to be configured.  This is helpful if you want to show the application user just the rows that they created.  Creating a level of privacy within the application.

 

  1. Open Portal Management (This can be found in the Apps List from https://make.powerapps.com)
  2. Open Basic Forms from the left menu under Content section.
  3. Select/Edit the Form that will be used to capture data
  4. Open the Basic Form Metadata tab (if you do not see this tab, it could be under the tab “Related”)
  5. Create a New Basic Form Metadata

    DaveUpton_1-1643396988995.png
    Basic Form: Verify this is correct
    Type: Attribute
    Attribute Logical Name: Choose the new Contact column that was added to the table from the dropdown.

    DaveUpton_2-1643396989016.png

    Scroll down to the section “Set Value on Save

    Check the box to Set Value on Save
    Type: Current Portal User
    Value: --- (leave blank)
    From Attribute: Choose Contact (contacted) from the dropdown.

    DaveUpton_3-1643396989030.png

    Click Save & Close when finished.

    (Note: If you want to edit the metadata record, click the column in front of the metadata record and use the sub menu to edit.)

    DaveUpton_4-1643396989036.png

Step 3: Update the view to filter on Created by Contact so that users only see records that they created.

 

For this step, there are several ways to access the Table Permission that we need to edit.

  1. Portal Management -> Security -> Table Permissions
  2. If editing the Portal
    1. Use the gear from the left menu
    2. Or you can choose the list control, on the portal page, to open the right properties pane and access from within the Permissions section.

 

The below example is using the gear from the edit portal page to open Table Permissions

 

Open/Edit the table permission created from Blog Part 2.

 

Change the following fields:

Access type: Contact access

Relationship: Set this to the relationship that was created when you added the contact column to your table.  You likely only have one option to choose from.

 

You should now see the Related tables populated with the correct tables and relationship.

 

This could have all be done at the time of creating the table permission if you had already added the contact field.   However, sometimes your data model may not be fully set before you start building forms and this step is to demonstrate how you might make these changes later, as you refactor, during development.

DaveUpton_5-1643396989061.png

 

At this point you should have a fully working portal that will allow registered users, that have been assigned to the Custom Web Role, to create new records and to see the records that they have created.  In the next steps we’ll walk through user registration and how an administrator will manually add registered users to the web role.  This process could also be automated with a PowerApp Automation but for the sake of simplicity, I will show this manually. 

 

 

Registering on your Portal

 

A blank portal has a built-in registration process that comes standard, out of the box.   A user has the option to register with a username/password or to use Azure Authentication.  If using Azure Authentication, the user would need to exist in your Azure domain prior to them registering on the portal.  I will demo registration with UN/PWD.

 

Access your new Portal.  This can be done from within editing the portal by clicking the link in the upper right to Browser website, or by clicking on the portal name under Apps. 

 

Click Sign in

Open the Registration Tab and complete the required fields.

 

DaveUpton_6-1643396989081.png

 

 

Once registered you should now see the user record in the Contact table within Dataverse.

 

DaveUpton_7-1643396989092.png

 

 

 

Assigning Web Role Permissions

 

The final step is to grant the user access to the protected Application page in your portal.

 

As with several properties within PowerApps, there are a number of places that this can be accessed. 

- From the contact record in Dataverse, Open the Web Roles tab (may be under Related if not showing up by default)

- From Portal Management -> Security -> Web Roles, open the web role and then the Contacts tab (may be under Related if not showing up by default)

- You can also open the Contacts from within Portal Management under Security. 

 

If using the contact record, you want to Add Existing Web Role as seen below.

 

DaveUpton_8-1643396989107.png

 

 

If using the Web Role from Portal Management, you want to add a contact to the role as seen below.

 

DaveUpton_9-1643396989118.png

 

 



Series Conclusion

 

Although it took 3 Parts to complete the setup, the process really should not take more then 30-60 minutes to complete based on your experience working with the various PowerApp components. Having said that, it could take longer if you spend more time on the database design, forms, list or portal design.

 

At this point you should have a fully working portal with the ability for users to register and admins to manually give them permission. You should also have a better understanding of the various management portals, settings, and proporties that are used to build and secure a Portal App.

Example of the Portal that I was building as I was learning how to develop a Portal App.  

DaveUpton_0-1643398274071.png

 

 

If this was helpful and/or if there are other topics you would like to see covered, please let us know. 

 

Thanks for following along,

Dave Upton

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.