1 21 22 package org.apache.derby.impl.sql.execute; 23 24 import org.apache.derby.catalog.UUID; 25 import org.apache.derby.iapi.sql.dictionary.TupleDescriptor; 26 import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor; 27 import org.apache.derby.iapi.sql.dictionary.DataDictionary; 28 import org.apache.derby.iapi.services.sanity.SanityManager; 29 import org.apache.derby.iapi.sql.Activation; 30 import org.apache.derby.iapi.reference.SQLState; 31 32 import org.apache.derby.iapi.error.StandardException; 33 34 import java.util.List ; 35 36 public abstract class PrivilegeInfo 37 { 38 39 48 abstract public void executeGrantRevoke( Activation activation, 49 boolean grant, 50 List grantees) 51 throws StandardException; 52 53 65 protected void checkOwnership( String user, 66 TupleDescriptor objectDescriptor, 67 SchemaDescriptor sd, 68 DataDictionary dd) 69 throws StandardException 70 { 71 if (!user.equals(sd.getAuthorizationId()) && 72 !user.equals(dd.getAuthorizationDatabaseOwner())) 73 throw StandardException.newException(SQLState.AUTH_NOT_OWNER, 74 user, 75 objectDescriptor.getDescriptorType(), 76 sd.getSchemaName(), 77 objectDescriptor.getDescriptorName()); 78 } 79 80 90 protected void addWarningIfPrivilegeNotRevoked( Activation activation, 91 boolean grant, 92 boolean privileges_revoked, 93 String grantee) 94 { 95 if(!grant && !privileges_revoked) 96 activation.addWarning(StandardException.newWarning 97 (SQLState.LANG_PRIVILEGE_NOT_REVOKED, grantee)); 98 } 99 } 100 | Popular Tags |