1 package org.hibernate.secure; 3 4 import javax.security.jacc.EJBMethodPermission ; 5 6 import org.hibernate.event.PreInsertEvent; 7 import org.hibernate.event.def.DefaultPreInsertEventListener; 8 import org.hibernate.secure.HibernatePermission; 9 10 15 public class JACCPreInsertEventListener extends DefaultPreInsertEventListener { 16 public boolean onPreInsert(PreInsertEvent event) { 17 18 EJBMethodPermission insertPermission = new EJBMethodPermission ( 19 event.getPersister().getEntityName(), 20 HibernatePermission.INSERT, 21 null, 22 null 23 ); 24 25 JACCPermissions.checkPermission( event.getEntity().getClass(), insertPermission ); 26 27 return super.onPreInsert( event ); 28 } 29 30 } 31 | Popular Tags |