public inbox for [email protected]  
help / color / mirror / Atom feed
RM5841: server.username can be empty when using .pg_service.conf
5+ messages / 3 participants
[nested] [flat]

* RM5841: server.username can be empty when using .pg_service.conf
@ 2020-09-19 12:52 Cyril Jouve <[email protected]>
  2020-09-21 04:00 ` Re: RM5841: server.username can be empty when using .pg_service.conf Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Cyril Jouve @ 2020-09-19 12:52 UTC (permalink / raw)
  To: pgadmin-hackers

fix for https://redmine.postgresql.org/issues/5841


Attachments:

  [application/octet-stream] 0001-server.username-can-be-None-when-using-.pg_service.c.patch (1.2K, 3-0001-server.username-can-be-None-when-using-.pg_service.c.patch)
  download | inline diff:
From 68b788d16e750097d1de1119ee043d6f353a6a2c Mon Sep 17 00:00:00 2001
From: Cyril Jouve <[email protected]>
Date: Sat, 19 Sep 2020 14:39:56 +0200
Subject: [PATCH] server.username can be None when using .pg_service.conf

---
 web/pgadmin/browser/server_groups/servers/__init__.py | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index ed8fae0f0..ccb47f1d3 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -1280,14 +1280,6 @@ class ServerNode(PGChildNodeView):
         if server is None:
             return bad_request(self.not_found_error_msg())
 
-        # Return if username is blank
-        if server.username is None:
-            return make_json_response(
-                status=200,
-                success=0,
-                errormsg=gettext(
-                    u"Please enter the server details to connect")
-            )
         if current_user and hasattr(current_user, 'id'):
             # Fetch User Details.
             user = User.query.filter_by(id=current_user.id).first()
-- 
2.28.0



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: RM5841: server.username can be empty when using .pg_service.conf
  2020-09-19 12:52 RM5841: server.username can be empty when using .pg_service.conf Cyril Jouve <[email protected]>
@ 2020-09-21 04:00 ` Akshay Joshi <[email protected]>
  2020-09-21 11:11   ` Re: RM5841: server.username can be empty when using .pg_service.conf Pradip Parkale <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Akshay Joshi @ 2020-09-21 04:00 UTC (permalink / raw)
  To: Pradip Parkale <[email protected]>; +Cc: pgadmin-hackers; Cyril Jouve <[email protected]>

Hi Pradip

Can you please review the patch as that condition we have added for Shared
Server implementation?

On Sat, Sep 19, 2020 at 6:22 PM Cyril Jouve <[email protected]> wrote:

> fix for https://redmine.postgresql.org/issues/5841
>


-- 
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Sr. Software Architect*
*EDB Postgres <http://edbpostgres.com>*

*Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: RM5841: server.username can be empty when using .pg_service.conf
  2020-09-19 12:52 RM5841: server.username can be empty when using .pg_service.conf Cyril Jouve <[email protected]>
  2020-09-21 04:00 ` Re: RM5841: server.username can be empty when using .pg_service.conf Akshay Joshi <[email protected]>
@ 2020-09-21 11:11   ` Pradip Parkale <[email protected]>
  2020-09-22 06:40     ` Re: RM5841: server.username can be empty when using .pg_service.conf Pradip Parkale <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Pradip Parkale @ 2020-09-21 11:11 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers; Cyril Jouve <[email protected]>

Hi Akshay,


On Mon, Sep 21, 2020 at 9:30 AM Akshay Joshi <[email protected]>
wrote:

> Hi Pradip
>
> Can you please review the patch as that condition we have added for Shared
> Server implementation?
>
Yes, we have added this for the shared server implementation. Please find
the attached for this issue.

>
> On Sat, Sep 19, 2020 at 6:22 PM Cyril Jouve <[email protected]> wrote:
>
>> fix for https://redmine.postgresql.org/issues/5841
>>
>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
> *pgAdmin Hacker | Sr. Software Architect*
> *EDB Postgres <http://edbpostgres.com>*
>
> *Mobile: +91 976-788-8246*
>


-- 
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation


Attachments:

  [application/x-patch] RM5841.patch (2.1K, 3-RM5841.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index ed8fae0f0..10efa4e87 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -194,14 +194,6 @@ class ServerModule(sg.ServerGroupPluginModule):
                     # set to true
                     continue
 
-                # if hide_shared_server or \
-                #         shared_server.name == auto_detected_server:
-                #     # Don't include shared server if hide shared server is
-                #     # set to true
-                #     continue
-
-                # if shared_server.name == auto_detected_server:
-                #     continue
                 server = self.get_shared_server_properties(server,
                                                            shared_server)
             connected = False
@@ -1281,7 +1273,7 @@ class ServerNode(PGChildNodeView):
             return bad_request(self.not_found_error_msg())
 
         # Return if username is blank
-        if server.username is None:
+        if server.username is None and not server.service:
             return make_json_response(
                 status=200,
                 success=0,
diff --git a/web/pgadmin/browser/server_groups/servers/static/js/server.js b/web/pgadmin/browser/server_groups/servers/static/js/server.js
index 37942da08..8a4be22b4 100644
--- a/web/pgadmin/browser/server_groups/servers/static/js/server.js
+++ b/web/pgadmin/browser/server_groups/servers/static/js/server.js
@@ -1208,7 +1208,7 @@ define('pgadmin.node.server', [
       $.get(server_url)
         .done(function(res) {
           if (res.shared && _.isNull(res.username) && data.user_id != current_user.id){
-            if (selectedTreeNodeData._type == 'server'){
+            if (selectedTreeNodeData._type == 'server' && !res.service){
               pgAdmin.Browser.Node.callbacks.show_obj_properties.call(
                 pgAdmin.Browser.Nodes[tree.itemData(item)._type], {action: 'edit'}
               );


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: RM5841: server.username can be empty when using .pg_service.conf
  2020-09-19 12:52 RM5841: server.username can be empty when using .pg_service.conf Cyril Jouve <[email protected]>
  2020-09-21 04:00 ` Re: RM5841: server.username can be empty when using .pg_service.conf Akshay Joshi <[email protected]>
  2020-09-21 11:11   ` Re: RM5841: server.username can be empty when using .pg_service.conf Pradip Parkale <[email protected]>
@ 2020-09-22 06:40     ` Pradip Parkale <[email protected]>
  2020-09-22 11:33       ` Re: RM5841: server.username can be empty when using .pg_service.conf Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Pradip Parkale @ 2020-09-22 06:40 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers; Cyril Jouve <[email protected]>

Hi Akshay,

Please find the updated patch.

On Mon, Sep 21, 2020 at 4:41 PM Pradip Parkale <
[email protected]> wrote:

> Hi Akshay,
>
>
> On Mon, Sep 21, 2020 at 9:30 AM Akshay Joshi <
> [email protected]> wrote:
>
>> Hi Pradip
>>
>> Can you please review the patch as that condition we have added for
>> Shared Server implementation?
>>
> Yes, we have added this for the shared server implementation. Please find
> the attached for this issue.
>
>>
>> On Sat, Sep 19, 2020 at 6:22 PM Cyril Jouve <[email protected]> wrote:
>>
>>> fix for https://redmine.postgresql.org/issues/5841
>>>
>>
>>
>> --
>> *Thanks & Regards*
>> *Akshay Joshi*
>> *pgAdmin Hacker | Sr. Software Architect*
>> *EDB Postgres <http://edbpostgres.com>*
>>
>> *Mobile: +91 976-788-8246*
>>
>
>
> --
> Thanks & Regards,
> Pradip Parkale
> Software Engineer | EnterpriseDB Corporation
>


-- 
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation


Attachments:

  [application/octet-stream] RM5841_v2.patch (5.3K, 3-RM5841_v2.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index ed8fae0f0..af845e531 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -194,14 +194,6 @@ class ServerModule(sg.ServerGroupPluginModule):
                     # set to true
                     continue
 
-                # if hide_shared_server or \
-                #         shared_server.name == auto_detected_server:
-                #     # Don't include shared server if hide shared server is
-                #     # set to true
-                #     continue
-
-                # if shared_server.name == auto_detected_server:
-                #     continue
                 server = self.get_shared_server_properties(server,
                                                            shared_server)
             connected = False
@@ -1280,8 +1272,9 @@ class ServerNode(PGChildNodeView):
         if server is None:
             return bad_request(self.not_found_error_msg())
 
-        # Return if username is blank
-        if server.username is None:
+        # Return if username is blank and the server is shared
+        if server.username is None and not server.service and \
+                server.shared:
             return make_json_response(
                 status=200,
                 success=0,
@@ -1819,6 +1812,7 @@ class ServerNode(PGChildNodeView):
                     tunnel_identity_file=server.tunnel_identity_file,
                     errmsg=errmsg,
                     _=gettext,
+                    service=server.service,
                     prompt_tunnel_password=prompt_tunnel_password,
                     prompt_password=prompt_password
                 )
@@ -1832,6 +1826,7 @@ class ServerNode(PGChildNodeView):
                     server_label=server.name,
                     username=server.username,
                     errmsg=errmsg,
+                    service=server.service,
                     _=gettext,
                 )
             )
diff --git a/web/pgadmin/browser/server_groups/servers/static/js/server.js b/web/pgadmin/browser/server_groups/servers/static/js/server.js
index 37942da08..8a4be22b4 100644
--- a/web/pgadmin/browser/server_groups/servers/static/js/server.js
+++ b/web/pgadmin/browser/server_groups/servers/static/js/server.js
@@ -1208,7 +1208,7 @@ define('pgadmin.node.server', [
       $.get(server_url)
         .done(function(res) {
           if (res.shared && _.isNull(res.username) && data.user_id != current_user.id){
-            if (selectedTreeNodeData._type == 'server'){
+            if (selectedTreeNodeData._type == 'server' && !res.service){
               pgAdmin.Browser.Node.callbacks.show_obj_properties.call(
                 pgAdmin.Browser.Nodes[tree.itemData(item)._type], {action: 'edit'}
               );
diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/password.html b/web/pgadmin/browser/server_groups/servers/templates/servers/password.html
index 641d44e09..9b2c425e3 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/servers/password.html
+++ b/web/pgadmin/browser/server_groups/servers/templates/servers/password.html
@@ -1,7 +1,13 @@
 <form name="frmPassword" id="frmPassword" style="height: 100%; width: 100%" onsubmit="return false;">
     <div>
-        <div><span class="font-weight-bold" >{{ _('Please enter the password for the user \'{0}\' to connect the server - "{1}"').format(username,
-            server_label) }}</span></div>
+        <div><span class="font-weight-bold" >
+            {% if service  %}
+                {{ _('Please enter the password for the user to connect the server - "{0}"').format(server_label) }}
+            {% else %}
+                {{ _('Please enter the password for the user \'{0}\' to connect the server - "{1}"').format(username,
+                server_label) }}
+            {% endif %}
+        </span></div>
         <div class="input-group row py-2">
             <label for="password" class="col-sm-2 col-form-label" aria-hidden="true">{{ _('Password') }}</label>
             <div class="col-sm-10">
diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/tunnel_password.html b/web/pgadmin/browser/server_groups/servers/templates/servers/tunnel_password.html
index ea1dc178c..5de642f85 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/servers/tunnel_password.html
+++ b/web/pgadmin/browser/server_groups/servers/templates/servers/tunnel_password.html
@@ -23,7 +23,13 @@
         </div>
         {% endif %}
         {% if prompt_password %}
-        <div><label class="font-weight-bold" for="password">{{ _('Database server password for the user \'{0}\' to connect the server "{1}"').format(username, server_label) }}</label></div>
+        <div><label class="font-weight-bold" for="password">
+            {% if service  %}
+                {{ _('Database server password for the user to connect the server "{0}"').format(server_label) }}
+            {% else %}
+                {{ _('Database server password for the user \'{0}\' to connect the server "{1}"').format(username, server_label) }}
+            {% endif %}
+        </label></div>
         <div class="input-group py-2">
             <div class="w-100">
               <input id="password" class="form-control" name="password" type="password">


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: RM5841: server.username can be empty when using .pg_service.conf
  2020-09-19 12:52 RM5841: server.username can be empty when using .pg_service.conf Cyril Jouve <[email protected]>
  2020-09-21 04:00 ` Re: RM5841: server.username can be empty when using .pg_service.conf Akshay Joshi <[email protected]>
  2020-09-21 11:11   ` Re: RM5841: server.username can be empty when using .pg_service.conf Pradip Parkale <[email protected]>
  2020-09-22 06:40     ` Re: RM5841: server.username can be empty when using .pg_service.conf Pradip Parkale <[email protected]>
@ 2020-09-22 11:33       ` Akshay Joshi <[email protected]>
  0 siblings, 0 replies; 5+ messages in thread

From: Akshay Joshi @ 2020-09-22 11:33 UTC (permalink / raw)
  To: Pradip Parkale <[email protected]>; +Cc: pgadmin-hackers; Cyril Jouve <[email protected]>

Thanks, patch applied

On Tue, 22 Sep, 2020, 12:10 Pradip Parkale, <[email protected]>
wrote:

> Hi Akshay,
>
> Please find the updated patch.
>
> On Mon, Sep 21, 2020 at 4:41 PM Pradip Parkale <
> [email protected]> wrote:
>
>> Hi Akshay,
>>
>>
>> On Mon, Sep 21, 2020 at 9:30 AM Akshay Joshi <
>> [email protected]> wrote:
>>
>>> Hi Pradip
>>>
>>> Can you please review the patch as that condition we have added for
>>> Shared Server implementation?
>>>
>> Yes, we have added this for the shared server implementation. Please find
>> the attached for this issue.
>>
>>>
>>> On Sat, Sep 19, 2020 at 6:22 PM Cyril Jouve <[email protected]> wrote:
>>>
>>>> fix for https://redmine.postgresql.org/issues/5841
>>>>
>>>
>>>
>>> --
>>> *Thanks & Regards*
>>> *Akshay Joshi*
>>> *pgAdmin Hacker | Sr. Software Architect*
>>> *EDB Postgres <http://edbpostgres.com>*
>>>
>>> *Mobile: +91 976-788-8246*
>>>
>>
>>
>> --
>> Thanks & Regards,
>> Pradip Parkale
>> Software Engineer | EnterpriseDB Corporation
>>
>
>
> --
> Thanks & Regards,
> Pradip Parkale
> Software Engineer | EnterpriseDB Corporation
>


^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2020-09-22 11:33 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-09-19 12:52 RM5841: server.username can be empty when using .pg_service.conf Cyril Jouve <[email protected]>
2020-09-21 04:00 ` Akshay Joshi <[email protected]>
2020-09-21 11:11   ` Pradip Parkale <[email protected]>
2020-09-22 06:40     ` Pradip Parkale <[email protected]>
2020-09-22 11:33       ` Akshay Joshi <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox