This article will provide instructions on how to enable read-only access for users in the Live App.
Use Case
Your application stores records that you want your users to access and view. However, it is important that your users are not able to make any changes or delete these records.
For instance, consider an application that stores Order records. Customers should be able to log in and view their Orders, but they should not have the ability to edit or delete them.
Requirements
The following are the requirements for this setup to be possible in your app:
-
Your application includes a table that stores records that you want your users to be able to view. In the example provided, this table is called the "Orders" table.
-
Your app has user logins activated with defined user roles.
Steps
First, we'll create a new user role and a dedicated login page for those users. Then, we can add read-only views like grids and details to allow users to view records without the ability to edit or delete them.
Adding a User Role
If you don’t have a user role already, you can add a new user role from the Data section of the Builder. To add a new user role, click on the “+” button in the user role section at the bottom of the left column.
Once you have added your user role, add at least one user record to log in and test this functionality.
Connect the Table to the User Role
Connection fields are used to link records from different tables together. The next step is to add a connection so each Order record can be connected to a Customer.
In the Data section of the Builder, select the Orders table from the left menu, then click the "+” button from the right Connections column to begin adding a new connection field:
This will open a modal popup walking you through the steps to add a connection. We want to connect each Order record to a Customer, so select “Customer” as the table to connect to:
Click “Next” to proceed to the next step and choose the connection type. Keep the default settings so each Order connects with one Customer, and each Customer can connect with many Orders.
Click “Add Connection” to submit this new connection. There will now be a Customer connection field on the Order table:
Now, from the Records section of the Builder, we can view this connection field and update the Order records. Connection fields work like “look-ups”, so you can click on any of the empty Customer cells to look up and select a Customer to connect to.
We'll select the test Customer that was added above:
Adding a New Page Displaying Records
Now that you have a user role that is connected to a table, you can display records for the logged-in user to view but not edit. In this example, Customers will be able to view a grid of their Orders but not make any changes to the Order.
Note: Essentially, you are adding a page that does not contain edit options for the Customer. This means a page with no forms, action links, or inline editing.
In the Pages section of the Builder, click the "+" to add a new page and select the "Login Page" option.
From there, we'll choose the option to "Limit permissions to specific user roles". In this example, we are limiting the logins to the Customer user role that we added.
Then, we can select the view type and which table's records will be displayed. In this example, we have selected a grid view displaying Order records:
Next, we will be prompted to add additional links to the view. To prevent edits to the records in the view, be sure not to select the "edit each record with a form" option.
Now, we have a page where Customers can log in and view their Order records but not edit those records.
Login & Test
After setting up the page that provides users with read-only access, you can now test your app by opening the page in the Live App. Simply click the "Go to Live App" button located in the top right corner.
If you have multiple pages, you may need to select it from the drop-down menu.
Log in with the email and password you created with your test Customer user.
The logged-in Customer will see a grid listing any Orders that you connected to that Customer. Each Order can be clicked to view more details, but there are no options to edit.
Note
I don't require logins but I want my records to be read-only:
Indeed, it is possible! To ensure that your Live App is read-only, the key aspect to consider is to make sure that there are no edit forms, inline editing on grids, or action links on your views.
If these features are not present, your users will not have the ability to make any changes.