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