Skip to content

Commit 68a41f6

Browse files
author
jef
committedMar 27, 2008
check schema privilege before table privilege
git-svn-id: http://svn.osgeo.org/qgis/trunk@8289 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 3005fd8 commit 68a41f6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎src/app/qgsdbsourceselect.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,8 @@ bool QgsDbSourceSelect::getTableInfo(PGconn *pg, bool searchGeometryColumnsOnly,
530530
QString sql = "select * from geometry_columns,pg_class,pg_namespace "
531531
"where relname=f_table_name and f_table_schema=nspname "
532532
"and pg_namespace.oid = pg_class.relnamespace "
533-
"and has_table_privilege('\"'||pg_namespace.nspname||'\".\"'||pg_class.relname||'\"','select')" // user has select privilege
533+
"and has_schema_privilege(pg_namespace.nspname,'usage') "
534+
"and has_table_privilege('\"'||pg_namespace.nspname||'\".\"'||pg_class.relname||'\"','select') " // user has select privilege
534535
"order by f_table_schema,f_table_name";
535536

536537
PGresult *result = PQexec(pg, sql.toUtf8());
@@ -587,11 +588,12 @@ bool QgsDbSourceSelect::getTableInfo(PGconn *pg, bool searchGeometryColumnsOnly,
587588
// geometry_columns table. This code is specific to postgresql,
588589
// but an equivalent query should be possible in other
589590
// databases.
590-
sql = "select pg_class.relname, pg_namespace.nspname, pg_attribute.attname, pg_class.relkind "
591+
sql = "select pg_class.relname,pg_namespace.nspname,pg_attribute.attname,pg_class.relkind "
591592
"from pg_attribute, pg_class, pg_namespace "
592593
"where pg_namespace.oid = pg_class.relnamespace "
593594
"and pg_attribute.atttypid = regtype('geometry') "
594595
"and pg_attribute.attrelid = pg_class.oid "
596+
"and has_schema_privilege(pg_namespace.nspname,'usage') "
595597
"and has_table_privilege('\"'||pg_namespace.nspname||'\".\"'||pg_class.relname||'\"','select') ";
596598
// user has select privilege
597599
if (searchPublicOnly)

0 commit comments

Comments
 (0)
Please sign in to comment.