From 93ddc4a5ba5faa997eb373526b4076525880531d Mon Sep 17 00:00:00 2001 From: Nikhil Mohite Date: Tue, 8 Jun 2021 19:33:03 +0530 Subject: [PATCH] Ensure that the user should be able to add members in Login/Role group while creating it. Fixes #6466 --- docs/en_US/release_notes_5_4.rst | 1 + .../servers/roles/templates/roles/sql/9.1_plus/create.sql | 7 +++++++ .../servers/roles/templates/roles/sql/9.4_plus/create.sql | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/docs/en_US/release_notes_5_4.rst b/docs/en_US/release_notes_5_4.rst index 02de94aa7..8ffc9cc6b 100644 --- a/docs/en_US/release_notes_5_4.rst +++ b/docs/en_US/release_notes_5_4.rst @@ -27,5 +27,6 @@ Bug fixes | `Issue #4203 `_ - Fixed the issue of renaming the database by another user. | `Issue #6404 `_ - Ensure that the Query Tool connection string should not be changed as per the 'Query Tool tab title'. +| `Issue #6466 `_ - Ensure that the user should be able to add members in Login/Role group while creating it. | `Issue #6478 `_ - Fixed duplicate SQL issue for tables with more than one partition. | `Issue #6482 `_ - Fixed an issue where the Foreground Color property of server dialog does not work. diff --git a/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/9.1_plus/create.sql b/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/9.1_plus/create.sql index 0f6aa6452..fc7b9e2b5 100644 --- a/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/9.1_plus/create.sql +++ b/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/9.1_plus/create.sql @@ -52,3 +52,10 @@ GRANT {{ conn|qtIdent(data.admins)|join(', ') }} TO {{ conn|qtIdent(data.rolname COMMENT ON ROLE {{ conn|qtIdent(data.rolname) }} IS {{ data.description|qtLiteral }}; {% endif %} + +{% if data.rol_admins and data.rol_admins|length > 0 %} + +GRANT {{ conn|qtIdent(data.rolname) }} TO {{ conn|qtIdent(data.rol_admins)|join(', ') }} WITH ADMIN OPTION;{% endif %}{% if data.rol_members and data.rol_members|length > 0 %} + +GRANT {{ conn|qtIdent(data.rolname) }} TO {{ conn|qtIdent(data.rol_members)|join(', ') }}; +{% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/9.4_plus/create.sql b/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/9.4_plus/create.sql index 8d0825a20..7022802f7 100644 --- a/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/9.4_plus/create.sql +++ b/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/9.4_plus/create.sql @@ -49,3 +49,10 @@ GRANT {{ conn|qtIdent(data.admins)|join(', ') }} TO {{ conn|qtIdent(data.rolname COMMENT ON ROLE {{ conn|qtIdent(data.rolname) }} IS {{ data.description|qtLiteral }}; {% endif %} + +{% if data.rol_admins and data.rol_admins|length > 0 %} + +GRANT {{ conn|qtIdent(data.rolname) }} TO {{ conn|qtIdent(data.rol_admins)|join(', ') }} WITH ADMIN OPTION;{% endif %}{% if data.rol_members and data.rol_members|length > 0 %} + +GRANT {{ conn|qtIdent(data.rolname) }} TO {{ conn|qtIdent(data.rol_members)|join(', ') }}; +{% endif %}