1 21 22 package org.apache.derby.impl.sql.execute; 23 24 import org.apache.derby.iapi.sql.Activation; 25 import org.apache.derby.iapi.services.sanity.SanityManager; 26 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext; 27 import org.apache.derby.iapi.store.access.TransactionController; 28 import org.apache.derby.iapi.sql.depend.DependencyManager; 29 import org.apache.derby.iapi.sql.dictionary.RoutinePermsDescriptor; 30 import org.apache.derby.iapi.sql.dictionary.AliasDescriptor; 31 import org.apache.derby.iapi.sql.dictionary.StatementRoutinePermission; 32 import org.apache.derby.iapi.sql.dictionary.DataDictionary; 33 import org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator; 34 import org.apache.derby.iapi.error.StandardException; 35 36 import java.util.Iterator ; 37 import java.util.List ; 38 39 public class RoutinePrivilegeInfo extends PrivilegeInfo 40 { 41 private AliasDescriptor aliasDescriptor; 42 43 public RoutinePrivilegeInfo( AliasDescriptor aliasDescriptor) 44 { 45 this.aliasDescriptor = aliasDescriptor; 46 } 47 48 57 public void executeGrantRevoke( Activation activation, 58 boolean grant, 59 List grantees) 60 throws StandardException 61 { 62 LanguageConnectionContext lcc = activation.getLanguageConnectionContext(); 64 DataDictionary dd = lcc.getDataDictionary(); 65 String currentUser = lcc.getAuthorizationId(); 66 TransactionController tc = lcc.getTransactionExecute(); 67 68 checkOwnership( currentUser, 70 aliasDescriptor, 71 dd.getSchemaDescriptor( aliasDescriptor.getSchemaUUID(), tc), 72 dd); 73 74 DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator(); 75 76 RoutinePermsDescriptor routinePermsDesc = ddg.newRoutinePermsDescriptor( aliasDescriptor, currentUser); 77 78 dd.startWriting(lcc); 79 for( Iterator itr = grantees.iterator(); itr.hasNext();) 80 { 81 boolean privileges_revoked = false; 85 String grantee = (String ) itr.next(); 86 if (dd.addRemovePermissionsDescriptor( grant, routinePermsDesc, grantee, tc)) 87 { 88 privileges_revoked = true; 89 dd.getDependencyManager().invalidateFor(routinePermsDesc, DependencyManager.REVOKE_PRIVILEGE_RESTRICT, lcc); 93 } 94 95 addWarningIfPrivilegeNotRevoked(activation, grant, privileges_revoked, grantee); 96 } 97 } } 99 | Popular Tags |