public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin][RM-6075]: Non-admin user is unable to view shared server created using 'Service'.
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin][RM-6075]: Non-admin user is unable to view shared server created using 'Service'.
@ 2021-01-12 11:55 Nikhil Mohite <[email protected]>
2021-01-13 06:54 ` Re: [pgAdmin][RM-6075]: Non-admin user is unable to view shared server created using 'Service'. Akshay Joshi <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Nikhil Mohite @ 2021-01-12 11:55 UTC (permalink / raw)
To: pgadmin-hackers
Hi Team,
Please find the attached patch for RM-6075:
<https://redmine.postgresql.org/issues/6075; Non-admin user is unable to
view shared server created using 'Service'.
1. Added migration to remove "Not null" constraints from a port column of
sharedserver table.
2. Updated model class of sharedserver table for the same.
--
*Thanks & Regards,*
*Nikhil Mohite*
*Software Engineer.*
*EDB Postgres* <https://www.enterprisedb.com/;
*Mob.No: +91-7798364578.*
Attachments:
[application/octet-stream] RM_6075.patch (4.1K, 3-RM_6075.patch)
download | inline diff:
diff --git a/web/migrations/versions/a39bd015b644_.py b/web/migrations/versions/a39bd015b644_.py
new file mode 100644
index 00000000..da887ab2
--- /dev/null
+++ b/web/migrations/versions/a39bd015b644_.py
@@ -0,0 +1,97 @@
+
+"""empty message
+
+Revision ID: a39bd015b644
+Revises: 81c7ffeffeee
+Create Date: 2021-01-12 15:46:49.283021
+
+"""
+from pgadmin.model import db
+
+
+# revision identifiers, used by Alembic.
+revision = 'a39bd015b644'
+down_revision = '81c7ffeffeee'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # Rename older table to save previous data
+ db.engine.execute("ALTER TABLE sharedserver RENAME TO sharedserver_old")
+
+ # Create new table with removed not null constraints for port column.
+ db.engine.execute("""
+ CREATE TABLE sharedserver (
+ id INTEGER NOT NULL,
+ user_id INTEGER NOT NULL,
+ server_owner VARCHAR(64),
+ servergroup_id INTEGER NOT NULL,
+ name VARCHAR(128) NOT NULL,
+ host VARCHAR(128),
+ port INTEGER,
+ maintenance_db VARCHAR(64),
+ username VARCHAR(64),
+ password VARCHAR(64),
+ role VARCHAR(64),
+ ssl_mode VARCHAR(16) NOT NULL CHECK(ssl_mode IN
+ ( 'allow' , 'prefer' , 'require' , 'disable' ,
+ 'verify-ca' , 'verify-full' )
+ ),
+ comment VARCHAR(1024),
+ discovery_id VARCHAR(128),
+ hostaddr TEXT(1024),
+ db_res TEXT,
+ passfile TEXT,
+ sslcert TEXT,
+ sslkey TEXT,
+ sslrootcert TEXT,
+ sslcrl TEXT,
+ sslcompression INTEGER DEFAULT 0,
+ bgcolor TEXT(10),
+ fgcolor TEXT(10),
+ service TEXT,
+ use_ssh_tunnel INTEGER DEFAULT 0,
+ tunnel_host TEXT,
+ tunnel_port TEXT,
+ tunnel_username TEXT,
+ tunnel_authentication INTEGER DEFAULT 0,
+ tunnel_identity_file TEXT,
+ shared BOOLEAN NOT NULL,
+ save_password BOOLEAN NOT NULL,
+ tunnel_password VARCHAR(64),
+ connect_timeout INTEGER ,
+ PRIMARY KEY(id),
+ FOREIGN KEY(user_id) REFERENCES user(id),
+ FOREIGN KEY(servergroup_id) REFERENCES servergroup(id)
+ );
+ """)
+
+ # Copy old data again into table.
+ db.engine.execute("""
+ INSERT INTO sharedserver (
+ id, user_id, server_owner, servergroup_id, name, host, port,
+ maintenance_db, username, password, role, ssl_mode, comment,
+ discovery_id, hostaddr, db_res, passfile, sslcert, sslkey,
+ sslrootcert, sslcrl, sslcompression, bgcolor, fgcolor, service,
+ use_ssh_tunnel, tunnel_host, tunnel_port, tunnel_username,
+ tunnel_authentication, tunnel_identity_file, shared, save_password,
+ tunnel_password, connect_timeout
+
+ ) SELECT
+ id, user_id, server_owner, servergroup_id, name, host, port,
+ maintenance_db, username, password, role, ssl_mode, comment,
+ discovery_id, hostaddr, db_res, passfile, sslcert, sslkey,
+ sslrootcert, sslcrl, sslcompression, bgcolor, fgcolor, service,
+ use_ssh_tunnel, tunnel_host, tunnel_port, tunnel_username,
+ tunnel_authentication, tunnel_identity_file, shared, save_password,
+ tunnel_password, connect_timeout
+ FROM sharedserver_old""")
+
+ # Drop older table.
+ db.engine.execute("DROP TABLE sharedserver_old")
+
+
+def downgrade():
+ # pgAdmin only upgrades, downgrade not implemented.
+ pass
diff --git a/web/pgadmin/model/__init__.py b/web/pgadmin/model/__init__.py
index 34136d63..d1f49818 100644
--- a/web/pgadmin/model/__init__.py
+++ b/web/pgadmin/model/__init__.py
@@ -379,8 +379,7 @@ class SharedServer(db.Model):
hostaddr = db.Column(db.String(128), nullable=True)
port = db.Column(
db.Integer(),
- db.CheckConstraint('port >= 1 AND port <= 65534'),
- nullable=False)
+ nullable=True)
maintenance_db = db.Column(db.String(64), nullable=True)
username = db.Column(db.String(64), nullable=False)
password = db.Column(db.String(64), nullable=True)
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin][RM-6075]: Non-admin user is unable to view shared server created using 'Service'.
2021-01-12 11:55 [pgAdmin][RM-6075]: Non-admin user is unable to view shared server created using 'Service'. Nikhil Mohite <[email protected]>
@ 2021-01-13 06:54 ` Akshay Joshi <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Akshay Joshi @ 2021-01-13 06:54 UTC (permalink / raw)
To: Nikhil Mohite <[email protected]>; +Cc: pgadmin-hackers
Thanks, patch applied.
On Tue, Jan 12, 2021 at 5:26 PM Nikhil Mohite <
[email protected]> wrote:
> Hi Team,
>
> Please find the attached patch for RM-6075:
> <https://redmine.postgresql.org/issues/6075; Non-admin user is unable to
> view shared server created using 'Service'.
>
> 1. Added migration to remove "Not null" constraints from a port column of
> sharedserver table.
> 2. Updated model class of sharedserver table for the same.
>
>
> --
> *Thanks & Regards,*
> *Nikhil Mohite*
> *Software Engineer.*
> *EDB Postgres* <https://www.enterprisedb.com/;
> *Mob.No: +91-7798364578.*
>
--
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres <http://edbpostgres.com>*
*Mobile: +91 976-788-8246*
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2021-01-13 06:54 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12 11:55 [pgAdmin][RM-6075]: Non-admin user is unable to view shared server created using 'Service'. Nikhil Mohite <[email protected]>
2021-01-13 06:54 ` 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