diff --git a/docs/en_US/images/role_definition.png b/docs/en_US/images/role_definition.png index afc2b7a8446..cd37fe141bf 100644 Binary files a/docs/en_US/images/role_definition.png and b/docs/en_US/images/role_definition.png differ diff --git a/docs/en_US/role_dialog.rst b/docs/en_US/role_dialog.rst index f951a37886c..fee97f4515d 100644 --- a/docs/en_US/role_dialog.rst +++ b/docs/en_US/role_dialog.rst @@ -31,6 +31,7 @@ Click the *Definition* tab to continue. Use the *Definition* tab to set a password and configure connection rules: +* If enabled, *Encrypted Password?* will consider the password as encrypted and will use ENCRYPTED keyword. * Provide a password that will be associated with the role in the *Password* field. * Provide an expiration date for the password in the *Account Expires* field diff --git a/web/pgadmin/browser/server_groups/servers/roles/__init__.py b/web/pgadmin/browser/server_groups/servers/roles/__init__.py index 9c25101b332..8e796cfe8cd 100644 --- a/web/pgadmin/browser/server_groups/servers/roles/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/roles/__init__.py @@ -677,11 +677,11 @@ def wrapped(self, **kwargs): 'rolcanlogin', 'rolsuper', 'rolcreatedb', 'rolcreaterole', 'rolinherit', 'rolreplication', 'rolconnlimit', 'rolvaliduntil', 'rolpassword', - 'rolbypassrls' + 'rolencryptedpassword', 'rolbypassrls' ] if self.manager.version >= 90200 else [ 'rolcanlogin', 'rolsuper', 'rolcreatedb', 'rolcreaterole', 'rolinherit', 'rolconnlimit', - 'rolvaliduntil', 'rolpassword' + 'rolvaliduntil', 'rolpassword', 'rolencryptedpassword' ] fetch_name, check_permission, \ diff --git a/web/pgadmin/browser/server_groups/servers/roles/static/js/role.ui.js b/web/pgadmin/browser/server_groups/servers/roles/static/js/role.ui.js index f363df4eae1..2211c1a2eaa 100644 --- a/web/pgadmin/browser/server_groups/servers/roles/static/js/role.ui.js +++ b/web/pgadmin/browser/server_groups/servers/roles/static/js/role.ui.js @@ -88,6 +88,11 @@ export default class RoleSchema extends BaseUISchema { mode: ['properties', 'edit', 'create'], disabled: obj.readOnly, }, + { + id: 'rolencryptedpassword', label: gettext('Encrypted Password?'), type: 'switch', + group: gettext('Definition'), mode: ['edit', 'create'], + deps: ['rolcanlogin'], disabled: obj.readOnly, + }, { id: 'rolpassword', label: gettext('Password'), type: 'password', group: gettext('Definition'), mode: ['edit', 'create'], diff --git a/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/default/create.sql index b2957c45020..3b13dfef293 100644 --- a/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/default/create.sql +++ b/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/default/create.sql @@ -32,10 +32,11 @@ CREATE ROLE {{ conn|qtIdent(data.rolname) }} WITH{% if data.rolcanlogin and data CONNECTION LIMIT {{ data.rolconnlimit }}{% endif %}{% if data.rolvaliduntil and data.rolvaliduntil is not none %} - VALID UNTIL {{ data.rolvaliduntil|qtLiteral(conn) }} {% endif %}{% if data.rolpassword %} - - PASSWORD {% if data.rolpassword is none %}NULL{% else %}{% if dummy %}'xxxxxx'{% else %} {{ data.rolpassword|qtLiteral(conn) }}{% endif %}{% endif %}{% endif %};{% if data.members and data.members|length > 0 %} - + VALID UNTIL {{ data.rolvaliduntil|qtLiteral(conn) }} {% endif %}{% if data.rolpassword %}{% if data.rolencryptedpassword %} + + ENCRYPTED PASSWORD{% else %} + + PASSWORD{% endif %}{% if data.rolpassword is none %}NULL{% else %}{% if dummy %}'xxxxxx'{% else %} {{ data.rolpassword|qtLiteral(conn) }}{% endif %}{% endif %}{% endif %};{% if data.members and data.members|length > 0 %} GRANT {{ conn|qtIdent(data.members)|join(', ') }} TO {{ conn|qtIdent(data.rolname) }};{% endif %}{% if data.admins and data.admins|length > 0 %} diff --git a/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/default/update.sql b/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/default/update.sql index 8f9daf10d7f..fd9a3b9ddd5 100644 --- a/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/default/update.sql +++ b/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/default/update.sql @@ -43,9 +43,11 @@ ALTER ROLE {{ conn|qtIdent(rolname) }}{% if 'rolcanlogin' in data %} {% endif %}{% if 'rolvaliduntil' in data %} VALID UNTIL {% if data.rolvaliduntil %}{{ data.rolvaliduntil|qtLiteral(conn) }}{% else %}'infinity' -{% endif %}{% endif %}{% if 'rolpassword' in data %} +{% endif %}{% endif %}{% if 'rolpassword' in data %}{% if data.rolencryptedpassword %} - PASSWORD{% if data.rolpassword is none %} NULL{% else %}{% if dummy %} 'xxxxxx'{% else %} {{ data.rolpassword|qtLiteral(conn) }}{% endif %}{% endif %}{% endif %};{% endif %} + ENCRYPTED PASSWORD{% else %} + + PASSWORD{% endif %}{% if data.rolpassword is none %} NULL{% else %}{% if dummy %} 'xxxxxx'{% else %} {{ data.rolpassword|qtLiteral(conn) }}{% endif %}{% endif %}{% endif %};{% endif %} {% if 'revoked_admins' in data and data.revoked_admins|length > 0