db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r536767 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/sql/dictionary/ViewDescriptor.java impl/sql/execute/RoutinePrivilegeInfo.java impl/sql/execute/TablePrivilegeInfo.java
Date Thu, 10 May 2007 07:49:09 GMT
Author: kahatlen
Date: Thu May 10 00:49:08 2007
New Revision: 536767

URL: http://svn.apache.org/viewvc?view=rev&rev=536767
Log:
DERBY-2594: Revoking a privilege from an SQL Object should invalidate
statements dependent on that object

Patch contributed by Dyre Tjeldvoll.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ViewDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RoutinePrivilegeInfo.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ViewDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ViewDescriptor.java?view=diff&rev=536767&r1=536766&r2=536767
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ViewDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ViewDescriptor.java
Thu May 10 00:49:08 2007
@@ -273,6 +273,14 @@
 			//don't do anything here. Later in makeInvalid method, we make  
 			//the ViewDescriptor drop itself. 
 		    case DependencyManager.REVOKE_PRIVILEGE:
+
+				// When REVOKE_PRIVILEGE gets sent to a
+				// TablePermsDescriptor we must also send
+				// INTERNAL_RECOMPILE_REQUEST to its Dependents which
+				// may be GPSs needing re-compilation. But Dependents
+				// could also be ViewDescriptors, which then also need
+				// to handle this event.
+			case DependencyManager.INTERNAL_RECOMPILE_REQUEST:
 		    	break;
 
 			//Notice that REVOKE_PRIVILEGE_RESTRICT is not caught earlier.
@@ -329,6 +337,14 @@
 			case DependencyManager.UPDATE_STATISTICS:
 			case DependencyManager.DROP_STATISTICS:
 			case DependencyManager.TRUNCATE_TABLE:
+
+				// When REVOKE_PRIVILEGE gets sent to a
+				// TablePermsDescriptor we must also send
+				// INTERNAL_RECOMPILE_REQUEST to its Dependents which
+				// may be GPSs needing re-compilation. But Dependents
+				// could also be ViewDescriptors, which then also need
+				// to handle this event.
+		    case DependencyManager.INTERNAL_RECOMPILE_REQUEST:
 				break;
 
 			//When REVOKE_PRIVILEGE gets sent (this happens for privilege 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RoutinePrivilegeInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RoutinePrivilegeInfo.java?view=diff&rev=536767&r1=536766&r2=536767
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RoutinePrivilegeInfo.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RoutinePrivilegeInfo.java
Thu May 10 00:49:08 2007
@@ -89,7 +89,19 @@
 				//Derby currently supports only restrict form of revoke execute
 				//privilege and that is why, we are sending invalidation action 
 				//as REVOKE_PRIVILEGE_RESTRICT rather than REVOKE_PRIVILEGE
-        		dd.getDependencyManager().invalidateFor(routinePermsDesc, DependencyManager.REVOKE_PRIVILEGE_RESTRICT,
lcc);
+				dd.getDependencyManager().invalidateFor
+					(routinePermsDesc,
+					 DependencyManager.REVOKE_PRIVILEGE_RESTRICT, lcc);
+
+				// When revoking a privilege from a Routine we need to
+				// invalidate all GPSs refering to it. But GPSs aren't
+				// Dependents of RoutinePermsDescr, but of the
+				// AliasDescriptor itself, so we must send
+				// INTERNAL_RECOMPILE_REQUEST to the AliasDescriptor's
+				// Dependents.
+				dd.getDependencyManager().invalidateFor
+					(aliasDescriptor,
+					 DependencyManager.INTERNAL_RECOMPILE_REQUEST, lcc);
 			}
 			
 			addWarningIfPrivilegeNotRevoked(activation, grant, privileges_revoked, grantee);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java?view=diff&rev=536767&r1=536766&r2=536767
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java
Thu May 10 00:49:08 2007
@@ -254,7 +254,18 @@
 				if (dd.addRemovePermissionsDescriptor( grant, tablePermsDesc, grantee, tc))
 				{
 					privileges_revoked = true;
-					dd.getDependencyManager().invalidateFor(tablePermsDesc, DependencyManager.REVOKE_PRIVILEGE,
lcc);
+					dd.getDependencyManager().invalidateFor
+						(tablePermsDesc,
+						 DependencyManager.REVOKE_PRIVILEGE, lcc);
+
+					// When revoking a privilege from a Table we need to
+					// invalidate all GPSs refering to it. But GPSs aren't
+					// Dependents of TablePermsDescr, but of the
+					// TableDescriptor itself, so we must send
+					// INTERNAL_RECOMPILE_REQUEST to the TableDescriptor's
+					// Dependents.
+					dd.getDependencyManager().invalidateFor
+						(td, DependencyManager.INTERNAL_RECOMPILE_REQUEST, lcc);
 				}
 			}
 			for( int i = 0; i < columnBitSets.length; i++)



Mime
View raw message