Using Policy Builder
You will learn how to use Policy Builder in this section.
Through Policy Builder, you can:
- Enable Policy Builder
 - Add a Rule
 - Modify a Rule
 - Preview a Policy
 
Enabling Policy Builder
The following section describes how to enable the Policy Builder feature. The instructions assume that have already created an Entitlements System.
- Log in to the Styra DAS UI.
 - In System, select your Entitlements System.
 - Expand the Entitlements System.
 - Select Policy > rules.rego.
 - Enable the Policy Builder by clicking the User icon > Feature preview > Policy Builder.
 - Click Enable.
 - Close Feature Preview.
 - Click the Builder icon in the authoring toolbar.
 
The Policy Builder is enabled.
Adding a Rule
The following section describes how to add a Rule in Policy Builder.
- In an Entitlements System with Policy Builder enabled, go to Policy > rules.rego.
 - Click Add rule in the authoring toolbar.
 - Select one of the available rules.
 - The new rule is added to the top of the Policy Builder.
 - In the toolbar, click Publish to apply the changes to your policy.
 
The new rule is added.
Modifying a Rule
The following section describes how to modify a Rule in Policy Builder.
Adding Conditions
The following steps are used to add a condition.
- In an Entitlements System with Policy Builder enabled, go to Policy > rules.rego.
 - Add a rule to your policy, or use an existing rule.
 - Select the rule where you will add a condition and the click the Plus icon (Add condition to rule).
 - Click Add condition.
 - In Filter, select a rule. The Add condition panel appears.
 - In the Add condition panel, set your parameters.
 - Click Save to finalize adding the condition to your rule.
 - Click Publish in the toolbar to apply the changes to your policy.
 
Conditions are applied to your rule.
Modifying Condition Parameters
The following steps are used to modify condition parameters.
- In an Entitlements System with Policy Builder enabled, go to Policy > rules.rego.
 - Hover over the condition to modify, and click the Pen icon to the right of the condition.
 - The Edit condition panel appears.
 - Modify the condition parameters.
 - Click Save to confirm the changes.
 - Click Publish in the toolbar to apply the changes to your policy.
 
The conditions of the rule are modified.
Removing Conditions
The following steps are used to remove conditions.
- In an Entitlements System with Policy Builder enabled, go to Policy > rules.rego.
 - Hover over the condition to remove it, and click the Trash icon to the right of the condition.
 - A confirmation dialog box appears.
 - Click Delete condition.
 - Click Publish in the toolbar to apply the changes to your policy.
 
The condition is removed.
Previewing a Policy
The following section describes how to preview a Policy in Policy Builder. This lets you confirm that the Policy returns the expected results, given a specific input document.
- In an Entitlements System with Policy Builder enabled, go to Policy > rules.rego.
 - In the toolbar, click the Preview icon.
 - Toggle Coverage to on and Exclude Stacks to off.
 - Click Preview to open the Input and Output panels.
 - In the Input panel, add an input document for the request to test.
 - Click Preview again to test your policy with the input document.
 - The results are displayed in Output. Any Rule that was fully evaluated shows a tag representing the decision of that Rule.
 - To the right of the Rule cards, the decision of the Policy as a whole is presented in the Outcome section.