Permissions for remote models
Manually set up permissions for remote models
When working with remote data models, remember that action permissions are handled differently. While common data model roles and permissions, including 'read' access, are configured in the Betty Blocks environment under the 'Roles and permissions' segment, local action-specific permissions are defined within each application's action flows. This article will describe the distinct process for setting up permissions for remote models.
Add models
First, make sure you've added a new remote model as described in the Setting your remote data source article. In our case, it's a remote model Post showing posted content of a certain user. Actions are added automatically along with the model.
The next step includes creating two schema models.
- One will store the authentication info, let's call it AuthInfo, and add a number property 'user_id' (and your other optional properties).
- Then, create another schema model storing data source parameters (DataSourceParams in our case)
- This model will relate to AuthInfo with Has one relation type
- Type in 'auth_info' as a name for this relation and add AuthInfo as an associated schema model
Set up an action
Come back to the initial remote model (Post) and navigate to one of its actions via the Actions tab. Let's pick up All for Remote Model Post action.
Open Start step in the mentioned action and add a custom object input variable. Give it a name and connect to the schema model we've created before - DataSourceParams.
Next, add the Condition step to establish the criteria for specific users to access the remote model. In this scenario, the variable params.auth_info.user_id is checked for existence. Consequently, if the condition is satisfied and the user is identified within the system, they will gain access to the Get Placeholder Data step.
If the condition is not met, an error will be triggered by adding a Raise Error step in the Else flow.
Surely, the schema model we've created is incomplete (containing only the auth user and id), but additional information can always be obtained through Logs.