[Schmitzm-commits] r1639 - trunk/schmitzm-core/src/main/java/de/schmitzm/geotools/postgres

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jul 21 14:39:15 CEST 2011


Author: alfonx
Date: 2011-07-21 14:39:13 +0200 (Thu, 21 Jul 2011)
New Revision: 1639

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/geotools/postgres/PGUtil.java
Log:


Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/geotools/postgres/PGUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/geotools/postgres/PGUtil.java	2011-07-21 12:27:28 UTC (rev 1638)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/geotools/postgres/PGUtil.java	2011-07-21 12:39:13 UTC (rev 1639)
@@ -195,4 +195,16 @@
 		}
 		return tables;
 	}
+
+	/**
+	 * Liefert <code>true</code> wenn der Benutzername im DBMS Superuser ist.
+	 */
+	public static boolean isSuperuser(Connection c, String username) throws SQLException {
+		ResultSet rs = c.createStatement().executeQuery(
+				"select usesuper from pg_user where usename = '" + username + "' and usesuper = true");
+		if (rs.next()) {
+			return true;
+		}
+		return false;
+	}
 }



More information about the Schmitzm-commits mailing list