Scenario
Your app stores records that you want your users to login and view. You do NOT want your users to edit or delete these records.
Example: you store “Orders” in your app and want your users to log in and view those Orders.
Requirements
The following are requirements for adding this recipe:
-
Your database has an object that stores records you want your users to view. In our example, these are Orders.
Knack Tip: Read more about security settings available with user logins to help ensure the security of your Live App pages.
-
Your app has user logins activated. The settings allow you to have logins for different user roles.
Recipe
These steps will add a new user role, and add a new page for those users to log in and access. By adding “read-only” views like tables and details to that scene, the user will only be able to view records, not edit or delete them.
Add a user role
If you don’t have a user role ready, click on your database and the “Add” button in the user role section at the bottom of the left column:
Add at least one Customer record to login and test with later.
Connect the records to the user role
Connection fields are used to link records from different objects together. The next step is to add a connection so each Order record can be connected to a Customer.
Click the Orders object from the left menu, then click the “Add a new Connection” link from the right column:
We want to connect each Order record to a Customer, so select “Customer” as the object to connect to:
Click “next” to 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 object:
Click on the “Records” link and update a few of your *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. Select the test Customer that was added above:
Add a new page
The following video will display how to add a “read-only” view for Customers. This will allow them to view their Orders but not make any changes to the Order.
Essentially, you are adding a page that does not contain edit options for the Customer.
Test the login
Click the “View” button from the top right to test your app (you may need to select it from the drop-down menu if you have more than one page).
Login with the email and password you created with your test Customer user.
The logged-in Customer will see a table 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: