Fix an issue where role is used as username for newly added servers when opening query tool. #5702

This commit is contained in:
Aditya Toshniwal 2023-02-01 13:11:00 +05:30 committed by GitHub
parent 103cf0eba5
commit 932dcd9666
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 16 deletions

View File

@ -268,7 +268,7 @@ class ServerModule(sg.ServerGroupPluginModule):
was_connected=was_connected,
errmsg=errmsg,
user_id=server.user_id,
user_name=server.username,
username=server.username,
shared=server.shared,
is_kerberos_conn=bool(server.kerberos_conn),
gss_authenticated=manager.gss_authenticated,
@ -593,7 +593,7 @@ class ServerNode(PGChildNodeView):
is_tunnel_password_saved=True
if server.tunnel_password is not None else False,
errmsg=errmsg,
user_name=server.username,
username=server.username,
shared=server.shared,
is_kerberos_conn=bool(server.kerberos_conn),
gss_authenticated=manager.gss_authenticated
@ -663,7 +663,7 @@ class ServerNode(PGChildNodeView):
if server.tunnel_password is not None else False,
errmsg=errmsg,
shared=server.shared,
user_name=server.username,
username=server.username,
is_kerberos_conn=bool(server.kerberos_conn),
gss_authenticated=manager.gss_authenticated
),
@ -845,7 +845,7 @@ class ServerNode(PGChildNodeView):
user_id=server.user_id,
user=manager.user_info if connected else None,
server_type='pg', # default server type
user_name=server.username,
username=server.username,
role=server.role,
is_password_saved=bool(server.save_password)
)

View File

@ -32,7 +32,7 @@ export function generateUrl(trans_id, parentData, sqlId) {
if(parentData.database.label) {
url_endpoint += `&database_name=${parentData.database.label}`;
}
if(!parentData.server.user_name && parentData.server.user?.name) {
if(!parentData.server.username && parentData.server.user?.name) {
url_endpoint += `&user=${parentData.server.user?.name}`;
}
}

View File

@ -136,7 +136,7 @@ function generateUrl(trans_id, connectionData, nodeData, parentData) {
+`&did=${parentData.database._id}`
+`&server_type=${parentData.server.server_type}`;
if(!parentData.server.user_name && parentData.server.user?.name) {
if(!parentData.server.username && parentData.server.user?.name) {
url_endpoint += `&user=${parentData.server.user?.name}`;
}

View File

@ -37,7 +37,7 @@ describe('FunctionSchema', ()=>{
connected: true,
user: {id: 10, name: 'postgres', is_superuser: true, can_create_role: true, can_create_db: true},
user_id: 1,
user_name: 'postgres',
username: 'postgres',
version: 130005,
server: {
host: '127.0.0.1',
@ -83,7 +83,7 @@ describe('FunctionSchema', ()=>{
can_create_db: true,
},
user_id: 1,
user_name: 'postgres',
username: 'postgres',
version: 130005,
server: {
host: '127.0.0.1',
@ -157,7 +157,7 @@ describe('FunctionSchema', ()=>{
catalog: {},
connected: true,
user_id: 1,
user_name: 'postgres',
username: 'postgres',
version: 130005,
server: {
host: '127.0.0.1',
@ -209,7 +209,7 @@ describe('FunctionSchema', ()=>{
catalog: {},
connected: true,
user_id: 1,
user_name: 'postgres',
username: 'postgres',
version: 130005,
server: {
host: '127.0.0.1',
@ -265,7 +265,7 @@ describe('FunctionSchema', ()=>{
node_info: {
connected: true,
user_id: 1,
user_name: 'postgres',
username: 'postgres',
version: 130005,
server: {
host: '127.0.0.1',
@ -310,7 +310,7 @@ describe('FunctionSchema', ()=>{
node_info: {
connected: true,
user_id: 1,
user_name: 'postgres',
username: 'postgres',
version: 130005,
server: {
host: '127.0.0.1',
@ -362,7 +362,7 @@ describe('FunctionSchema', ()=>{
catalog: {},
connected: true,
user_id: 1,
user_name: 'postgres',
username: 'postgres',
version: 130005,
server: {
host: '127.0.0.1',

View File

@ -31,7 +31,7 @@ describe('LanguageSchema', ()=>{
node_info: {connected: true,
user: {id: 10, name: 'postgres', is_superuser: true, can_create_role: true, can_create_db: true},
user_id: 1,
user_name: 'postgres',
username: 'postgres',
version: 120005,
},
},

View File

@ -24,7 +24,7 @@ describe('PublicationSchema', ()=>{
connected: true,
user: {id: 10, name: 'postgres', is_superuser: true, can_create_role: true, can_create_db: true},
user_id: 1,
user_name: 'postgres',
username: 'postgres',
version: 130005,
},
},

View File

@ -24,7 +24,7 @@ describe('SubscriptionSchema', ()=>{
connected: true,
user: {id: 10, name: 'postgres', is_superuser: true, can_create_role: true, can_create_db: true},
user_id: 1,
user_name: 'postgres',
username: 'postgres',
version: 130005,
server: {host: '127.0.0.1', port: 5432},
},