[QGIS Commit] r8289 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Mar 27 10:50:11 EDT 2008


Author: jef
Date: 2008-03-27 10:50:11 -0400 (Thu, 27 Mar 2008)
New Revision: 8289

Modified:
   trunk/qgis/src/app/qgsdbsourceselect.cpp
Log:
check schema privilege before table privilege

Modified: trunk/qgis/src/app/qgsdbsourceselect.cpp
===================================================================
--- trunk/qgis/src/app/qgsdbsourceselect.cpp	2008-03-27 13:08:30 UTC (rev 8288)
+++ trunk/qgis/src/app/qgsdbsourceselect.cpp	2008-03-27 14:50:11 UTC (rev 8289)
@@ -530,7 +530,8 @@
   QString sql = "select * from geometry_columns,pg_class,pg_namespace "
     "where relname=f_table_name and f_table_schema=nspname "
     "and pg_namespace.oid = pg_class.relnamespace "
-    "and has_table_privilege('\"'||pg_namespace.nspname||'\".\"'||pg_class.relname||'\"','select')"	// user has select privilege
+    "and has_schema_privilege(pg_namespace.nspname,'usage') "
+    "and has_table_privilege('\"'||pg_namespace.nspname||'\".\"'||pg_class.relname||'\"','select') "	// user has select privilege
     "order by f_table_schema,f_table_name";
 
   PGresult *result = PQexec(pg, sql.toUtf8());
@@ -587,11 +588,12 @@
   // geometry_columns table. This code is specific to postgresql,
   // but an equivalent query should be possible in other
   // databases.
-  sql = "select pg_class.relname, pg_namespace.nspname, pg_attribute.attname,  pg_class.relkind "
+  sql = "select pg_class.relname,pg_namespace.nspname,pg_attribute.attname,pg_class.relkind "
     "from pg_attribute, pg_class, pg_namespace "
     "where pg_namespace.oid = pg_class.relnamespace "
     "and pg_attribute.atttypid = regtype('geometry') "
     "and pg_attribute.attrelid = pg_class.oid "
+    "and has_schema_privilege(pg_namespace.nspname,'usage') "
     "and has_table_privilege('\"'||pg_namespace.nspname||'\".\"'||pg_class.relname||'\"','select') ";
   // user has select privilege
   if (searchPublicOnly)



More information about the QGIS-commit mailing list