Added hints for 'Using' and 'With check' options of RLS Policy node.

This commit is contained in:
Pradip Parkale 2020-07-02 15:32:27 +05:30 committed by Akshay Joshi
parent e0fa4a6cb2
commit 8b10315e2a
2 changed files with 14 additions and 1 deletions

View File

@ -120,6 +120,19 @@ define('pgadmin.node.row_security_policy', [
control: 'sql-field', visible: true, group: gettext('Commands'),
disabled: 'disableWithCheck',
},
{
id: 'rls_expression_key_note', label: gettext('RLS policy expression'),
type: 'note', group: 'Commands', mode: ['create', 'edit'],
text: [
'<ul><li>',
'<strong>', gettext('Using: '), '</strong>',
gettext('This expression will be added to queries that refer to the table if row level security is enabled. Rows for which the expression returns true will be visible. Any rows for which the expression returns false or null will not be visible to the user (in a SELECT), and will not be available for modification (in an UPDATE or DELETE). Such rows are silently suppressed; no error is reported.'),
'</li><li>',
'<strong>', gettext('With check: '), '</strong>',
gettext('This expression will be used in INSERT and UPDATE queries against the table if row level security is enabled. Only rows for which the expression evaluates to true will be allowed. An error will be thrown if the expression evaluates to false or null for any of the records inserted or any of the records that result from the update.'),
'</li></ul>',
].join(''),
},
{
id: 'policyowner', label: gettext('Role'), cell: 'string',
control: 'node-list-by-name',

View File

@ -1248,7 +1248,7 @@ define('pgadmin.node.table', [
return msg;
}
this.errorModel.unset('partition_keys');
if (this.get('rlspolicy') && this.isNew() && this.changed.rlspolicy){
if (this.get('rlspolicy') && this.changed.rlspolicy){
Alertify.alert(
gettext('Check Policy?'),
gettext('Please check if any policy exist. If no policy exists for the table, a default-deny policy is used, meaning that no rows are visible or can be modified by other users')