diff --git a/docs/en_US/release_notes_5_7.rst b/docs/en_US/release_notes_5_7.rst index 2f0f849ea..23b0efcb7 100644 --- a/docs/en_US/release_notes_5_7.rst +++ b/docs/en_US/release_notes_5_7.rst @@ -22,6 +22,7 @@ Bug fixes | `Issue #6544 `_ - Fixed width limitation issue in PSQL tool window. | `Issue #6564 `_ - Fixed an issue where columns with sequences get altered unnecessarily with a schema diff tool. | `Issue #6572 `_ - Partially fixes the data output panel display issue. +| `Issue #6641 `_ - Enables pgAdmin to retrieve user permissions in case of nested roles which helps to terminate the session for AWS RDS. | `Issue #6663 `_ - Fixed no attribute '_asdict' error when connecting the database server. | `Issue #6671 `_ - Fixed UnboundLocalError where local variable 'user_id' referenced before assignment. | `Issue #6682 `_ - Renamed 'Auto rollback?' to 'Auto rollback on error?'. diff --git a/web/pgadmin/static/js/slickgrid/editors.js b/web/pgadmin/static/js/slickgrid/editors.js index 4e386eb28..4ca2c05b6 100644 --- a/web/pgadmin/static/js/slickgrid/editors.js +++ b/web/pgadmin/static/js/slickgrid/editors.js @@ -47,7 +47,7 @@ import Alertify from 'pgadmin.alertifyjs'; // return json editor element function getJsonEditor() { - return $('
'); + return $('
'); } // Generate and return editor buttons @@ -396,7 +396,7 @@ import Alertify from 'pgadmin.alertifyjs'; var jsonContainer = document.getElementById('pg-json-editor'); var options = { modes: ['code', 'form', 'tree','preview'], - onError: function (){ Alertify.alert(gettext('Please fix errors in json contents before switching mode.'));} + onError: function (){ Alertify.error(gettext('Please fix errors in json contents before switching mode.'));} }; $editor = new JSONEditor(jsonContainer, options); $editor.setText(data); @@ -415,7 +415,7 @@ import Alertify from 'pgadmin.alertifyjs'; var jsonContainer = document.getElementById('pg-json-editor'); var options = { modes: ['code', 'form', 'tree','preview'], - onError: function (){Alertify.alert(gettext('Please fix errors in json contents before switching mode.'));} + onError: function (){Alertify.error(gettext('Please fix errors in json contents before switching mode.'));} }; if(jsonContainer) { $editor = new JSONEditor(jsonContainer, options); @@ -628,6 +628,7 @@ import Alertify from 'pgadmin.alertifyjs'; this.position = function(position) { calculateEditorPosition(position, $wrapper); + position.top = Math.max(position.top, 0); $wrapper .css('top', position.top) .css('left', position.left); @@ -645,26 +646,30 @@ import Alertify from 'pgadmin.alertifyjs'; this.loadValue = function(item) { var data = defaultValue = item[args.column.field]; tmpdata = data; - if(args.column.column_type_internal === 'jsonb' && !Array.isArray(data)) { - data = JSONBigNumber.stringify(JSONBigNumber.parse(data), null, 4); + if(args.column.column_type_internal === 'jsonb' && !Array.isArray(data) && data != null) { + data = JSONBigNumber.stringify(JSONBigNumber.parse(data), null, 2); } else if (Array.isArray(data)) { var temp = []; $.each(data, function(i, val) { if (typeof val === 'object') { - temp.push(JSONBigNumber.stringify(val, null, 4)); + temp.push(JSONBigNumber.stringify(val, null,2)); } else { temp.push(val); } }); data = '[' + temp.join() + ']'; } - /* if data is string then convert to json*/ - if (typeof data === 'string') - data = JSON.parse(data); + /* set editor content to empty if value is null*/ + if (_.isNull(data)){ + defaultValue = ''; + data = ''; + } + /* Create editor if required & set data*/ require.ensure(['jsoneditor'], function(require) { var JSONEditor = require('jsoneditor'); var jsonContainer = document.getElementById('pg-json-editor'); + jsonContainer.setAttribute('readonly', true); let options = { modes: ['code', 'form', 'tree', 'preview'], onEditable: function() { @@ -673,7 +678,7 @@ import Alertify from 'pgadmin.alertifyjs'; }; if(jsonContainer) { $editor = new JSONEditor(jsonContainer, options); - $editor.set(data); + $editor.setText(data); } }, function(error){ throw(error); diff --git a/web/pgadmin/static/scss/_jsoneditor.overrides.scss b/web/pgadmin/static/scss/_jsoneditor.overrides.scss index 7c54c88aa..21938413e 100644 --- a/web/pgadmin/static/scss/_jsoneditor.overrides.scss +++ b/web/pgadmin/static/scss/_jsoneditor.overrides.scss @@ -162,6 +162,11 @@ div.jsoneditor-tree button.jsoneditor-button:focus { background-color: $color-bg; } +/* Ace editor code background readonly*/ +#pg-json-editor[readonly] .ace-jsoneditor .ace_scroller{ + background-color: $color-gray-light; + opacity: $btn-disabled-opacity; +} /* Ace editor hide indent guide */ .ace-jsoneditor .ace_indent-guide { @@ -188,7 +193,6 @@ div.jsoneditor-tree button.jsoneditor-button:focus { background-color:$color-bg !important; } - /* /* font setting all other mode */ /* form, tree, code, preview, schema-error */ div.jsoneditor-default, @@ -206,6 +210,19 @@ div.jsoneditor-tree{ background-color:$color-bg; } +/* read only mode */ +#pg-json-editor[readonly] { + & div.jsoneditor-tree, + & div.jsoneditor td, + & div.jsoneditor-readonly, + & div.jsoneditor-value, + & div.jsoneditor-field, + & div.jsoneditor-tree button.jsoneditor-button:focus { + background-color: $color-gray-light !important; + opacity: 0.85; + } +} + div.jsoneditor td.jsoneditor-tree { vertical-align: middle; } @@ -332,6 +349,19 @@ div.jsoneditor-value[contenteditable=true]:hover color: $color-fg !important; } +/* Replace help text */ +.pico-modal-contents p{ + visibility: hidden; + display: flex; + margin-bottom: -1rem; +} + +.pico-modal-contents p::after{ + visibility: visible; + position: absolute; + content: "Enter a JMESPath query to filter, sort, or transform the JSON data."; + display: block; +} /* Fields */ .jsoneditor-modal, diff --git a/web/pgadmin/utils/driver/psycopg2/connection.py b/web/pgadmin/utils/driver/psycopg2/connection.py index 695124273..c36b94fb7 100644 --- a/web/pgadmin/utils/driver/psycopg2/connection.py +++ b/web/pgadmin/utils/driver/psycopg2/connection.py @@ -605,11 +605,14 @@ WHERE db.datname = current_database()""") can_create_role, CASE WHEN roles.rolsuper THEN true ELSE roles.rolcreatedb END as can_create_db, - CASE WHEN 'pg_signal_backend'=ANY(ARRAY( - SELECT pg_catalog.pg_roles.rolname FROM - pg_catalog.pg_auth_members m JOIN pg_catalog.pg_roles ON - (m.roleid = pg_catalog.pg_roles.oid) WHERE - m.member = roles.oid)) THEN True + CASE WHEN 'pg_signal_backend'=ANY(ARRAY(WITH RECURSIVE cte AS ( + SELECT pg_roles.oid,pg_roles.rolname FROM pg_roles + WHERE pg_roles.oid = roles.oid + UNION ALL + SELECT m.roleid,pgr.rolname FROM cte cte_1 + JOIN pg_auth_members m ON m.member = cte_1.oid + JOIN pg_roles pgr ON pgr.oid = m.roleid) + SELECT rolname FROM cte)) THEN True ELSE False END as can_signal_backend FROM pg_catalog.pg_roles as roles