How to use the application's Private and Public option for Pages

In this tutorial, you learn how to make your application's data in pages public or private, based on a setting in My Betty Blocks.

Private mode

Applications are public by default, meaning that everyone (with the right authorization) can view data via Pages or directly via the Data API. Next to this public mode, applications can also be used in private mode. This page explains what private mode means, when you can use it and how you can use it.

What is it?

Applications can be used in one of two modes: public or private.
Public applications are the default, where end-users can interact with data via Pages or via the Data API. Access to data is managed by model permissions only.
Private applications follow the same rules as public applications, with one addition: only Builders can interact with data. So, data is only available when someone authenticated as a Builder. Builders are members of an application and can be managed via My Betty Blocks.

When can I use it?

When building a new application, you want to focus on just that: building the main framework of the application, set-up your data models, filling the back office with data, etc. More advanced topics like role-based model permissions should not be part of this first phase of an application’s life. Or in other words: you don’t want to worry about accidentally exposing sensitive data to the public because some model permissions are not set (correctly).

When an application is in private mode, only Builders you assigned to the application can interact with the data. While model permissions are still applied as normal, the check on authentication as a Builder provides an extra safety net for your data.

How can I use it?

The application private mode can be used via two steps. First, you have to enable the private mode via My BB. Second, you can use your application in private mode via Pages or directly communicate with the Data API via the GraphQL Playground.

Enable private mode

  • Go to My Betty Blocks via https://my.bettyblocks.com/
  • Open the configuration page for your application by clicking on the Applications button in the left sidebar and then search for your application.
  • Click the three-dotted button and then click on Settings.
  • Scroll down to the Advanced section and flip the switch for Private mode.

Use with Pages

The following steps show how you can use private mode in combination with models that are accessible for reading by the public role.

  • Make sure private mode is enabled for your application.
  • Open the back office of your application via `https://< betty-application-identifier >.bettyblocks.com`
  • Make sure that the model you want to use allows the public role to read this data.
  • Go to the Pages overview by clicking on Pages in the left sidebar and open the new pages overview by clicking on the button Go to new pages overview.
  • Create a new page by clicking on the New page button.
  • Put a Data table element on the page and connect it to the model that allows the public role to read from it. Configure the table columns to show properties from the model.
  • Click the Play button in the left sidebar to compile and open your page.

When you are not authenticated as a Builder, the page redirects you to a login form where you can enter your Builder credentials. These are the same credentials you use to log in to the back office of your application.

Enter your credentials and click on the Log in button. You will be redirected to your page and the table will show your data.

And that's how to use the public/private setting of your application in pages!