Graphical user interface and system for defining and maintaining code-based policies
Some embodiments of the invention provide a method for defining code-based policies. The method generates a policy-builder first view of a policy for display in a graphical user interface (GUI) by processing a syntax tree that is generated from a code second view of the policy. The method receives, through the policy-builder first view, a modification to a portion of the policy. To reflect the modification, the method updates a portion of the syntax tree that corresponds to the portion of the policy that is affected by the modification. Based on the updating of the syntax tree, the method updates the code second view by modifying a portion of the code second view that corresponds to the updated portion of the syntax tree.
1 . A method comprising:
in a graphical user interface (GUI) that displays a policy-builder view of a policy for which at least a first rule is defined, the policy-builder view comprising (i) at least a first row that comprises a definition of the first rule, and (ii) a set of selectable items for modifying the policy:
receiving a selection of a first selectable item to modify the policy by adding a second rule to the policy;
based on the selection, displaying a second row in the policy-builder view, the second row comprising a set of three selectable boxes for defining the second rule and directing interactions to a first selectable box of the set of three selectable boxes;
after receiving an operand first value as input for the first selectable box, directing interactions to a second selectable box of the set of three selectable boxes;
after receiving an operator second value as input for the second selectable box, directing interactions to a third selectable box of the set of three selectable boxes;
after receiving an operand third value as input for the third selectable box, providing a second selectable item for saving the second rule; and
upon receiving a selection to save the second rule, updating the policy to include the second rule.
2 . The method of claim 1 , wherein each selectable box in the set of three selectable boxes comprises a dropdown menu of selectable input options for populating the selectable box.
3 . The method of claim 2 , wherein the GUI enables each selectable box in the set of selectable boxes to be populated via at least one of (i) entering text into the selectable box and (ii) selecting a selectable input option from the dropdown menu of the selectable box.
4 . The method of claim 1 , wherein before receiving the operator second value, the GUI does not accept input for the third selectable box, wherein after receiving the operator second value, the method further comprises:
determining that the operator second value is not a Boolean value; and
based on said determining, accepting input for the third selectable box.
5 . The method of claim 1 , wherein before receiving the operator second value, the GUI does not accept input for the third selectable box, wherein after receiving the operator second value, the method further comprises:
determining that the operator second value is a Boolean value; and
based on said determining, removing the third selectable box from the second row.
6 . The method of claim 1 , wherein receiving the selection to save comprises receiving a selection of the second selectable item for saving the second rule.
7 . The method of claim 1 , wherein the second row further comprises one or more selectable items for adding conditions to the second rule.
8 . The method of claim 7 , wherein the set of three selectable boxes comprises a first subset of selectable boxes, the method further comprising:
receiving a selection to add a particular condition to the second rule; and
based on said receiving, displaying a second subset of selectable boxes for defining the particular condition.
9 . The method of claim 1 , wherein the policy-builder view of the policy is a policy-builder first view of the policy that is generated by processing a syntax tree that is generated from a code second view of the policy.
10 . The method of claim 9 , wherein updating the policy further comprises updating (i) the policy-builder first view of the policy and (ii) the code second view of the policy.
11 . The method of claim 1 , wherein the policy is defined in a declarative language.
12 . The method of claim 1 , wherein the set of selectable items for modifying the policy comprises at least a first selectable item for adding rules to the policy, a second selectable item for modifying existing rules of the policy, and a third selectable item for adding new conditions to the existing rules of the policy.
13 . A non-transitory machine readable medium storing a program for execution by at least one processing unit for defining code-based policies in a graphical user interface (GUI) that displays a policy-builder view of a policy for which at least a first rule is defined, the policy-builder view comprising (i) at least a first row that comprises a definition of the first rule, and (ii) a set of selectable items for modifying the policy, the program comprising sets of instructions for:
receiving a selection of a first selectable item to modify the policy by adding a second rule to the policy;
based on the selection, displaying a second row in the policy-builder view, the second row comprising a set of three selectable boxes for defining the second rule and directing interactions to a first selectable box of the set of three selectable boxes;
after receiving an operand first value as input for the first selectable box, directing interactions to a second selectable box of the set of three selectable boxes;
after receiving an operator second value as input for the second selectable box, directing interactions to a third selectable box of the set of three selectable boxes;
after receiving an operand third value as input for the third selectable box, providing a second selectable item for saving the second rule; and
upon receiving a selection to save the second rule, updating the policy to include the second rule.
14 . The non-transitory machine readable medium of claim 13 , wherein each selectable box in the set of three selectable boxes comprises a dropdown menu of selectable input options for populating the selectable box.
15 . The non-transitory machine readable medium of claim 14 , wherein the GUI enables each selectable box in the set of selectable boxes to be populated via at least one of (i) entering text into the selectable box and (ii) selecting a selectable input option from the dropdown menu of the selectable box.
16 . The non-transitory machine readable medium of claim 13 , wherein the policy-builder view of the policy is a policy-builder first view of the policy that is generated by processing a syntax tree that is generated from a code second view of the policy.
17 . The non-transitory machine readable medium of claim 16 , wherein the set of instructions for updating the policy comprises a set of instructions for updating (i) the policy-builder first view of the policy and (ii) the code second view of the policy.
18 . The non-transitory machine readable medium of claim 13 , wherein the policy is defined in a declarative language.
19 . The non-transitory machine readable medium of claim 13 , wherein the set of selectable items for modifying the policy comprises at least a first selectable item for adding rules to the policy, a second selectable item for modifying existing rules of the policy, and a third selectable item for adding new conditions to the existing rules of the policy.
20 . A device comprising:
a memory; and
at least one processor configured to:
in a graphical user interface (GUI) that displays a policy-builder view of a policy for which at least a first rule is defined, the policy-builder view comprising (i) at least a first row that comprises a definition of the first rule, and (ii) a set of selectable items for modifying the policy:
receive a selection of a first selectable item to modify the policy by adding a second rule to the policy;
based on the selection, display a second row in the policy-builder view, the second row comprising a set of three selectable boxes for defining the second rule and directing interactions to a first selectable box of the set of three selectable boxes;
after receipt of an operand first value as input for the first selectable box, direct interactions to a second selectable box of the set of three selectable boxes;
after receipt of an operator second value as input for the second selectable box, direct interactions to a third selectable box of the set of three selectable boxes;
after receipt of an operand third value as input for the third selectable box, provide a second selectable item for saving the second rule; and
upon receipt of a selection to save the second rule, updating the policy to include the second rule.