mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed following schema diff issues:
1) Avoid template databases from the Database drop-down list. 2) Exclude system schemas while comparing two databases. 3) Escape group name for XSS.
This commit is contained in:
@@ -251,9 +251,16 @@ class DatabaseView(PGChildNodeView):
|
||||
'datlastsysoid']
|
||||
return last_system_oid
|
||||
|
||||
def get_nodes(self, gid, sid, show_system_templates=False):
|
||||
def get_nodes(self, gid, sid, is_schema_diff=False):
|
||||
res = []
|
||||
last_system_oid = self.retrieve_last_system_oid()
|
||||
|
||||
# if is_schema_diff then no need to show system templates.
|
||||
if is_schema_diff and self.manager.db_info is not None and \
|
||||
self.manager.did in self.manager.db_info:
|
||||
last_system_oid = \
|
||||
self.manager.db_info[self.manager.did]['datlastsysoid']
|
||||
|
||||
server_node_res = self.manager
|
||||
|
||||
db_disp_res = None
|
||||
@@ -303,8 +310,8 @@ class DatabaseView(PGChildNodeView):
|
||||
return res
|
||||
|
||||
@check_precondition(action="nodes")
|
||||
def nodes(self, gid, sid):
|
||||
res = self.get_nodes(gid, sid)
|
||||
def nodes(self, gid, sid, is_schema_diff=False):
|
||||
res = self.get_nodes(gid, sid, is_schema_diff)
|
||||
|
||||
return make_json_response(
|
||||
data=res,
|
||||
|
||||
@@ -413,7 +413,7 @@ class SchemaView(PGChildNodeView):
|
||||
)
|
||||
|
||||
@check_precondition
|
||||
def nodes(self, gid, sid, did, scid=None):
|
||||
def nodes(self, gid, sid, did, scid=None, is_schema_diff=False):
|
||||
"""
|
||||
This function will create all the child nodes within the collection
|
||||
Here it will create all the schema node.
|
||||
@@ -422,6 +422,8 @@ class SchemaView(PGChildNodeView):
|
||||
gid: Server Group ID
|
||||
sid: Server ID
|
||||
did: Database ID
|
||||
scid: Schema ID
|
||||
is_schema_diff: True if called by schema diff tool
|
||||
|
||||
Returns:
|
||||
JSON of available schema child nodes
|
||||
@@ -437,9 +439,13 @@ class SchemaView(PGChildNodeView):
|
||||
["'%s'"] * len(schema_restrictions.split(',')))
|
||||
param = schema_res % (tuple(schema_restrictions.split(',')))
|
||||
|
||||
show_system_objects = self.blueprint.show_system_objects
|
||||
if is_schema_diff:
|
||||
show_system_objects = False
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, self._SQL_PREFIX + self._NODES_SQL]),
|
||||
show_sysobj=self.blueprint.show_system_objects,
|
||||
show_sysobj=show_system_objects,
|
||||
_=gettext,
|
||||
scid=scid,
|
||||
schema_restrictions=param
|
||||
|
||||
Reference in New Issue
Block a user