Add Password exec command and Expiration time to server export JSON and also allow them to import. #6258

This commit is contained in:
Anil Sahoo
2023-06-15 11:49:06 +05:30
committed by GitHub
parent 64446790d2
commit 789f169135
4 changed files with 20 additions and 2 deletions

View File

@@ -178,7 +178,9 @@ The following example shows both a minimally defined and a fully defined server:
"TunnelHost": "192.168.1.253",
"TunnelPort": 22,
"TunnelUsername": "username",
"TunnelAuthentication": 0
"TunnelAuthentication": 0,
"PasswordExecCommand": "echo 'test'",
"PasswordExecExpiration": 100
}
}
}

View File

@@ -309,6 +309,7 @@ export default class ServerSchema extends BaseUISchema {
id: 'passexec_cmd', label: gettext('Password exec command'), type: 'text',
group: gettext('Advanced'),
mode: ['properties', 'edit', 'create'],
disabled: pgAdmin.server_mode == 'True',
},
{
id: 'passexec_expiration', label: gettext('Password exec expiration (seconds)'), type: 'int',

View File

@@ -35,7 +35,9 @@
"TunnelHost": "192.168.1.253",
"TunnelPort": "22",
"TunnelUsername": "username",
"TunnelAuthentication": 0
"TunnelAuthentication": 0,
"PasswordExecCommand": "echo 'test'",
"PasswordExecExpiration": 100
}
}
}

View File

@@ -486,6 +486,13 @@ def dump_database_servers(output_file, selected_servers,
add_value(attr_dict, "ConnectionParameters",
server.connection_params)
# if desktop mode
if not current_app.config['SERVER_MODE']:
add_value(attr_dict, "PasswordExecCommand",
server.passexec_cmd)
add_value(attr_dict, "PasswordExecExpiration",
server.passexec_expiration)
servers_dumped = servers_dumped + 1
server_dict[servers_dumped] = attr_dict
@@ -711,6 +718,12 @@ def load_database_servers(input_file, selected_servers,
new_server.kerberos_conn = obj.get("KerberosAuthentication", None)
# if desktop mode
if not current_app.config['SERVER_MODE']:
new_server.passexec_cmd = obj.get("PasswordExecCommand", None)
new_server.passexec_expiration = obj.get(
"PasswordExecExpiration", None)
db.session.add(new_server)
try: