db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r590720 - in /db/derby/code/trunk/java: engine/org/apache/derby/catalog/SystemProcedures.java testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AuthenticationTest.java
Date Wed, 31 Oct 2007 15:42:03 GMT
Author: djd
Date: Wed Oct 31 08:42:02 2007
New Revision: 590720

URL: http://svn.apache.org/viewvc?rev=590720&view=rev
Log:
DERBY-3160 Make SYSCS_GET_USER_ACCESS treat the passed in user name in its normal form, as
for example would be passed by using the expression CURRENT_USER

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AuthenticationTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java?rev=590720&r1=590719&r2=590720&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java Wed Oct
31 08:42:02 2007
@@ -1626,21 +1626,27 @@
     /**
      * Get the connection level authorization for
      * a specific user - SYSCS_UTIL.SYSCS_GET_USER_ACCESS.
+     * 
+     * @param userName name of the user in its normal form (not a SQL identifier).
+
      */
     public static String SYSCS_GET_USER_ACCESS(String userName)
         throws SQLException
     {
         try {
-            String sqlUser = IdUtil.getUserAuthorizationId(userName);
             
+            if (userName == null)
+                throw StandardException.newException(SQLState.AUTH_INVALID_USER_NAME,
+                        userName);
+           
             String fullUserList =
                 SYSCS_GET_DATABASE_PROPERTY(Property.FULL_ACCESS_USERS_PROPERTY);
-            if (IdUtil.idOnList(sqlUser, fullUserList))
+            if (IdUtil.idOnList(userName, fullUserList))
                 return Property.FULL_ACCESS;
             
             String readOnlyUserList =
                 SYSCS_GET_DATABASE_PROPERTY(Property.READ_ONLY_ACCESS_USERS_PROPERTY);
-            if (IdUtil.idOnList(sqlUser, readOnlyUserList))
+            if (IdUtil.idOnList(userName, readOnlyUserList))
                 return Property.READ_ONLY_ACCESS;
             
             String defaultAccess = 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AuthenticationTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AuthenticationTest.java?rev=590720&r1=590719&r2=590720&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AuthenticationTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AuthenticationTest.java
Wed Oct 31 08:42:02 2007
@@ -223,6 +223,7 @@
         for (int i = 1; i < USERS.length; i++)
         {          
             String jdbcUserName = USERS[i];
+            
             boolean delimited = jdbcUserName.charAt(0) == '"';
             String normalUserName;
             if (delimited)
@@ -254,8 +255,8 @@
             connUser.close();
             
             psGetAccess.setString(1, normalUserName);
-            //JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(),
-            //        "READONLYACCESS");
+            JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(),
+                    "READONLYACCESS");
             commit();
             
             // clear the property.
@@ -269,8 +270,8 @@
             connUser.close(); 
             
             psGetAccess.setString(1, normalUserName);
-            //JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(),
-            //        "FULLACCESS");
+            JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(),
+                    "FULLACCESS");
             commit();
             
             
@@ -290,8 +291,8 @@
             connUser.close();
             
             psGetAccess.setString(1, normalUserName);
-            //JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(),
-            //        "READONLYACCESS");
+            JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(),
+                    "READONLYACCESS");
             commit();           
 
         }
@@ -732,19 +733,19 @@
         
         PreparedStatement psGetAccess = conn1.prepareStatement(
                 "VALUES SYSCS_UTIL.SYSCS_GET_USER_ACCESS(?)");
-        psGetAccess.setString(1, "jamie");
+        psGetAccess.setString(1, "JAMIE");
         JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(), "FULLACCESS");
         
         psGetAccess.setString(1, "DAN");
         JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(), "FULLACCESS");
         
-        psGetAccess.setString(1, "system");
+        psGetAccess.setString(1, "SYSTEM");
         JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(), "FULLACCESS");
         
         psGetAccess.setString(1, "AMES");
         JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(), "READONLYACCESS");
         
-        psGetAccess.setString(1, "mickEy");
+        psGetAccess.setString(1, "MICKEY");
         JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(), "READONLYACCESS");
 
         // unknown user
@@ -765,13 +766,13 @@
         psGetAccess.setString(1, "AMES");
         JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(), "FULLACCESS");
         
-        psGetAccess.setString(1, "miCKEY");
+        psGetAccess.setString(1, "MICKEY");
         JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(), "READONLYACCESS");
-        psGetAccess.setString(1, "jamie");
+        psGetAccess.setString(1, "JAMIE");
         JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(), "FULLACCESS");      

         psGetAccess.setString(1, "DAN");
         JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(), "FULLACCESS");      
 
-        psGetAccess.setString(1, "system");
+        psGetAccess.setString(1, "SYSTEM");
         JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(), "FULLACCESS");
 
         // and change AMES back again
@@ -782,13 +783,13 @@
         psGetAccess.setString(1, "AMES");
         JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(), "READONLYACCESS");
         
-        psGetAccess.setString(1, "miCKEY");
+        psGetAccess.setString(1, "MICKEY");
         JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(), "READONLYACCESS");
-        psGetAccess.setString(1, "jamie");
+        psGetAccess.setString(1, "JAMIE");
         JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(), "FULLACCESS");      

         psGetAccess.setString(1, "DAN");
         JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(), "FULLACCESS");      
 
-        psGetAccess.setString(1, "system");
+        psGetAccess.setString(1, "SYSTEM");
         JDBC.assertSingleValueResultSet(psGetAccess.executeQuery(), "FULLACCESS");
 
         // add a new users in
@@ -903,13 +904,7 @@
         CallableStatement csSetAccess = conn1.prepareCall(
             "CALL SYSCS_UTIL.SYSCS_SET_USER_ACCESS(?, ?)"); 
         
-        // Clear out the properties to ensure we start afresh
-        setDatabaseProperty("derby.database.fullAccessUsers", 
-                null, conn1);
-        setDatabaseProperty("derby.database.readOnlyAccessUsers", 
-                null, conn1);
-        
-        csSetAccess.setString(1, "dan");
+        csSetAccess.setString(1, "DAN");
         csSetAccess.setString(2, "FULLACCESS");
         csSetAccess.execute();
 



Mime
View raw message