Documentation of Row Level Security Policies. Fixes #5581

pull/33/head
Yogesh Mahajan 2020-06-22 15:26:14 +05:30 committed by Akshay Joshi
parent 9d25973a77
commit d2f4a62bf3
8 changed files with 62 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 110 KiB

View File

@ -22,6 +22,7 @@ node, and select *Create Cast...*
foreign_key_dialog
index_dialog
primary_key_dialog
rls_policy_dialog
rule_dialog
table_dialog
trigger_dialog

View File

@ -19,6 +19,7 @@ Housekeeping
| `Issue #5325 <https://redmine.postgresql.org/issues/5325>`_ - Improve code coverage and API test cases for Collations.
| `Issue #5574 <https://redmine.postgresql.org/issues/5574>`_ - Cleanup Windows build scripts and ensure Windows x64 builds will work.
| `Issue #5581 <https://redmine.postgresql.org/issues/5581>`_ - Documentation of Row Level Security Policies.
Bug fixes
*********

View File

@ -0,0 +1,57 @@
.. _rls_policy_dialog:
**************************
`RLS Policy Dialog`:index:
**************************
Use the *RLS Policy* dialog to Create a Row Level Security Policy.
.. note::
If the Row Level Security is enabled at table level and no policy is created then by default *Deny Policy* is applied. That means, no rows are visible or can be modified for that table.
The *RLS Policy* dialog creates a Row Level Security Policy through the following dialog tabs: *General*, and *Commands*. The *SQL* tab displays the SQL code generated by dialog selections.
.. image:: images/rls_policy_general_tab.png
:alt: RLS Policy General Tab
:align: center
Use the fields in the *General* tab to define the RLS Policy:
* Use the *Name* field to add a descriptive name for the RLS Policy. The name will be displayed in the *pgAdmin* tree control.
* Use the drop-down listbox next to *Role* to select the Role to which the RLS Policy is to be applied.
Click the *Commands* tab to continue.
.. image:: images/rls_policy_commands_tab.png
:alt: RLS Policy Commands Tab
:align: center
Use the fields in the *Commands* tab to define the RLS Policy:
* Use the drop-down listbox next to *Event* to select the command to which policy applies. Valid options are ALL, SELECT, INSERT, UPDATE, and DELETE. Default is ALL.
* Use the *Using* field to add a SQL conditional expression returning boolean. This expression will be added to queries that refer to the table if row level security is enabled.
* Use the *With Check* field to add a SQL conditional expression returning boolean. This expression will be used in INSERT and UPDATE queries against the table if row level security is enabled.
Click the *SQL* tab to continue.
Your entries in the *RLS Policy* dialog generate a SQL command (see an example
below). Use the *SQL* tab for review; revisit or switch tabs to make any
changes to the SQL command.
Example
*******
The following is an example of the sql command generated by user selections in
the *RLS Policy* dialog:
.. image:: images/rls_policy_sql_tab.png
:alt: RLS Policy sql tab
:align: center
The example shown demonstrates creating a RLS Policy named *account_managers* that applies the Row Level Security on the *accounts* table.
* Click the *Info* button (i) to access online help.
* Click the *Save* button to save work.
* Click the *Cancel* button to exit without saving work.
* Click the *Reset* button to restore configuration parameters.

View File

@ -7,7 +7,7 @@
Use the *Table* dialog to create or modify a table.
The *Table* dialog organizes the development of a table through the following
dialog tabs: *General*, *Columns*, *Constraints*, *Advanced*, *Parameter*, and
dialog tabs: *General*, *Columns*, *Constraints*, *Advanced*, *Parition*, *Parameter*, and
*Security*. The *SQL* tab displays the SQL code generated by dialog selections.
.. image:: images/table_general.png
@ -389,6 +389,8 @@ Click the *Advanced* tab to continue.
Use the fields in the *Advanced* tab to define advanced features for the table:
* Move the *RLS Policy?* switch to the *Yes* position to enable the Row Level Security.
* Move the *Force RLS Policy?* to the *Yes* position to force the policy on the owner of the table.
* Use the drop-down listbox next to *Of type* to copy the table structure from
the specified composite type. Please note that a typed table will be dropped
if the type is dropped (with DROP TYPE ... CASCADE).