Thread: Importing servers with setup.py --load-servers with the same server group name for multiple users
Importing servers with setup.py --load-servers with the same server group name for multiple users
We have pgadmin4 version 4.2 installed in server mode so it can be used by several people.
When creating an account for a new user, no servers are defined.
To setup these servers you can use the import functionality
If you use the example from “https://www.pgadmin.org/docs/pgadmin4/dev/export_import_servers.html”
you get the message:
python setup.py --load-servers servers.json --user foo1@foo.nl
Added 2 Server Group(s) and 2 Server(s).
When you use the same json to import for an other user you get the message:
python setup.py --load-servers servers.json --user foo2@foo.nl
Added 0 Server Group(s) and 2 Server(s).
No servers added. The second user does not see the servers, it looks like they are not created.
If you use the same json but change the ‘Group’ names it will be imported correctly.
So for each users the ‘Group’ names has to be unique.
Is there a solution to import the same json import file for multiple users and for each user the ‘Group’ names will be the same?
Thanks,
Henk van Til
Re: Importing servers with setup.py --load-servers with the sameserver group name for multiple users
Hi,We have pgadmin4 version 4.2 installed in server mode so it can be used by several people.
When creating an account for a new user, no servers are defined.
To setup these servers you can use the import functionality
If you use the example from “https://www.pgadmin.org/docs/pgadmin4/dev/export_import_servers.html”
you get the message:
python setup.py --load-servers servers.json --user foo1@foo.nl
Added 2 Server Group(s) and 2 Server(s).
When you use the same json to import for an other user you get the message:
python setup.py --load-servers servers.json --user foo2@foo.nl
Added 0 Server Group(s) and 2 Server(s).
No servers added. The second user does not see the servers, it looks like they are not created.
If you use the same json but change the ‘Group’ names it will be imported correctly.
So for each users the ‘Group’ names has to be unique.
Is there a solution to import the same json import file for multiple users and for each user the ‘Group’ names will be the same?
groups = ServerGroup.query.filter_by(user_id=user_id)
Then find the line (around 254) that reads:
groups = ServerGroup.query.all()
and change it to:groups = ServerGroup.query.filter_by(user_id=user_id)
You can see the diff at https://redmine.postgresql.org/projects/pgadmin4/repository/revisions/73b144c45c991340f1b0c4ca70a6457be1fd5feb/diff/web/setup.py.
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Re: Importing servers with setup.py --load-servers with the same server group name for multiple users
Thanks for the quick response. It works perfect now.
Kind regards,
Henk van Til
----- Original Message ----
From: Dave Page <dpage@pgadmin.org>
To: "Henk F. van Til" <henk.vantil@isp.solcon.nl>
Cc: "pgadmin-support lists.postgresql.org" <pgadmin-support@lists.postgresql.org>
Sent: Don, 21 Feb 2019 16:45
Subject: Re: Importing servers with setup.py --load-servers with the same server group name for multiple users
Hi,We have pgadmin4 version 4.2 installed in server mode so it can be used by several people.
When creating an account for a new user, no servers are defined.
To setup these servers you can use the import functionality
If you use the example from “https://www.pgadmin.org/docs/pgadmin4/dev/export_import_servers.html”
you get the message:
python setup.py --load-servers servers.json --user foo1@foo.nl
Added 2 Server Group(s) and 2 Server(s).
When you use the same json to import for an other user you get the message:
python setup.py --load-servers servers.json --user foo2@foo.nl
Added 0 Server Group(s) and 2 Server(s).
No servers added. The second user does not see the servers, it looks like they are not created.
If you use the same json but change the ‘Group’ names it will be imported correctly.
So for each users the ‘Group’ names has to be unique.
Is there a solution to import the same json import file for multiple users and for each user the ‘Group’ names will be the same?
groups = ServerGroup.query.filter_by(user_id=user_id)
Then find the line (around 254) that reads:
groups = ServerGroup.query.all()
and change it to:
groups = ServerGroup.query.filter_by(user_id=user_id)
You can see the diff at https://redmine.postgresql.org/projects/pgadmin4/repository/revisions/73b144c45c991340f1b0c4ca70a6457be1fd5feb/diff/web/setup.py.
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Re: Importing servers with setup.py --load-servers with the sameserver group name for multiple users
Hi Dave,
Thanks for the quick response. It works perfect now.
Kind regards,
Henk van Til
----- Original Message ----
From: Dave Page <dpage@pgadmin.org>
To: "Henk F. van Til" <henk.vantil@isp.solcon.nl>
Cc: "pgadmin-support lists.postgresql.org" <pgadmin-support@lists.postgresql.org>
Sent: Don, 21 Feb 2019 16:45
Subject: Re: Importing servers with setup.py --load-servers with the same server group name for multiple usersHiOn Thu, Feb 21, 2019 at 12:59 PM Henk F. van Til <henk.vantil@isp.solcon.nl> wrote:Hi,We have pgadmin4 version 4.2 installed in server mode so it can be used by several people.
When creating an account for a new user, no servers are defined.
To setup these servers you can use the import functionality
If you use the example from “https://www.pgadmin.org/docs/pgadmin4/dev/export_import_servers.html”
you get the message:
python setup.py --load-servers servers.json --user foo1@foo.nl
Added 2 Server Group(s) and 2 Server(s).
When you use the same json to import for an other user you get the message:
python setup.py --load-servers servers.json --user foo2@foo.nl
Added 0 Server Group(s) and 2 Server(s).
No servers added. The second user does not see the servers, it looks like they are not created.
If you use the same json but change the ‘Group’ names it will be imported correctly.
So for each users the ‘Group’ names has to be unique.
Is there a solution to import the same json import file for multiple users and for each user the ‘Group’ names will be the same?
Thanks for the report. I've fixed this for 4.3.If you want to fix your existing installation, take a backup of the setup.py file, then edit the original. Find the line (194 in the current GIT head) that reads:groups = ServerGroup.query.all()and change it to:groups = ServerGroup.query.filter_by(user_id=user_id)
Then find the line (around 254) that reads:groups = ServerGroup.query.all()
and change it to:groups = ServerGroup.query.filter_by(user_id=user_id)
You can see the diff at https://redmine.postgresql.org/projects/pgadmin4/repository/revisions/73b144c45c991340f1b0c4ca70a6457be1fd5feb/diff/web/setup.py.--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company