Associating an Authorization Policy with Form Configuration

Last edit:  Jan 17, 2019

Contributors:  lemingos

This guide will help you associate an Authorization Policy with Form Configuration.

Requirements

So that you can follow the steps in this tutorial, you should understand the concept of Authorization Policy, and you should have created an Authorization Policy.

Steps

Associating an Authorization Policy with Form Configuration is a two-step process:

Step 1: Create Form Configuration

Assuming you have a simple form that allows to change the user's last name, the configuration file can look like this:

---
name: update_last_name
resource: User
fields:
  last_name:
    validation:
      presence: {}
---
...

Step 2: Add authorization_policies key to Form Configuration

In order to associate the Authorization Policy with the form, add a new authorization_policies key, and then specify the array of policy names associated with this form.

To ensure that only Johns will be able to submit this form, update the configuration to include the policy:

---
name: update_last_name
resource: User
authorization_policies:
  - only_allowed_by_johns
...

Next steps

Congratulations! You know how to associate an Authorization Policy with Form Configuration. Now you can learn about associating an Authorization Policy with a page.

Questions?

We are always happy to help with any questions you may have. Check out our Help page, or contact us.