db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r896146 - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/sql/dictionary/ engine/org/apache/derby/impl/sql/catalog/ testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Tue, 05 Jan 2010 17:41:43 GMT
Author: rhillegas
Date: Tue Jan  5 17:41:42 2010
New Revision: 896146

URL: http://svn.apache.org/viewvc?rev=896146&view=rev
Log:
-d

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SchemaDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/PermissionsCacheable.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SchemaDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SchemaDescriptor.java?rev=896146&r1=896145&r2=896146&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SchemaDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SchemaDescriptor.java
Tue Jan  5 17:41:42 2010
@@ -155,7 +155,7 @@
 	//// Implementation
 	private final String			name;
 	private UUID			oid;
-	private final String			aid;
+	private String			aid;
 
     private final boolean isSystem;
     private final boolean isSYSIBM;
@@ -219,6 +219,17 @@
 	}
 
 	/**
+	 * Sets the authorization id of the schema. This is only used by the DataDictionary
+     * during boot in order to patch up the authorization ids on system schemas.
+	 *
+	 * @param newAuthorizationID What is is
+	 */
+	public void setAuthorizationId( String newAuthorizationID )
+	{
+		aid = newAuthorizationID;
+	}
+
+	/**
 	 * Gets the oid of the schema 
 	 *
 	 * @return	An oid

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=896146&r1=896145&r2=896146&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
Tue Jan  5 17:41:42 2010
@@ -7097,6 +7097,10 @@
         SchemaDescriptor sd = locateSchemaRow
             (SchemaDescriptor.IBM_SYSTEM_SCHEMA_NAME, tc );
         authorizationDatabaseOwner = sd.getAuthorizationId();
+
+        systemSchemaDesc.setAuthorizationId( authorizationDatabaseOwner );
+        sysIBMSchemaDesc.setAuthorizationId( authorizationDatabaseOwner );
+        systemUtilSchemaDesc.setAuthorizationId( authorizationDatabaseOwner );
     }
     
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/PermissionsCacheable.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/PermissionsCacheable.java?rev=896146&r1=896145&r2=896146&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/PermissionsCacheable.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/PermissionsCacheable.java
Tue Jan  5 17:41:42 2010
@@ -75,6 +75,7 @@
 				TableDescriptor td = dd.getTableDescriptor( tablePermsKey.getTableUUID());
 				SchemaDescriptor sd = td.getSchemaDescriptor();
 				if( sd.isSystemSchema())
+                {
 					// RESOLVE The access to system tables is hard coded to SELECT only to everyone.
 					// Is this the way we want Derby to work? Should we allow revocation of read access
 					// to system tables? If so we must explicitly add a row to the SYS.SYSTABLEPERMISSIONS
@@ -84,18 +85,25 @@
 															(String) null,
 															tablePermsKey.getTableUUID(),
 															"Y", "N", "N", "N", "N", "N");
+                    // give the permission the same UUID as the system table
+                    ((TablePermsDescriptor) permissions).setUUID( tablePermsKey.getTableUUID()
);
+                }
 				else if( tablePermsKey.getGrantee().equals( sd.getAuthorizationId()))
+                {
 					permissions = new TablePermsDescriptor( dd,
 															tablePermsKey.getGrantee(),
 															Authorizer.SYSTEM_AUTHORIZATION_ID,
 															tablePermsKey.getTableUUID(),
 															"Y", "Y", "Y", "Y", "Y", "Y");
+                }
 				else
+                {
 					permissions = new TablePermsDescriptor( dd,
 															tablePermsKey.getGrantee(),
 															(String) null,
 															tablePermsKey.getTableUUID(),
 															"N", "N", "N", "N", "N", "N");
+                }
 			}
 		}
 		else if( key instanceof ColPermsDescriptor)

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java?rev=896146&r1=896145&r2=896146&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java
Tue Jan  5 17:41:42 2010
@@ -10151,4 +10151,19 @@
         george.close();
         monica.close();
     }
+    
+    /**
+     * DERBY-4502
+     *
+     * Allow creation of views against system tables when authorization is enabled.
+     */
+    public void test_derby_4502() throws Exception
+    {
+        Connection mamta1 = openUserConnection("mamta1");
+        Statement st_mamta1 = mamta1.createStatement();
+
+        st_mamta1.execute(
+            "create view v_4502( a ) as select tablename from sys.systables");
+    }
+    
 }



Mime
View raw message