KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > secure > JACCPreInsertEventListener


1 //$Id: JACCPreInsertEventListener.java,v 1.8 2005/07/21 04:56:17 oneovthafew Exp $
2
package org.hibernate.secure;
3
4 import javax.security.jacc.EJBMethodPermission JavaDoc;
5
6 import org.hibernate.event.PreInsertEvent;
7 import org.hibernate.event.def.DefaultPreInsertEventListener;
8 import org.hibernate.secure.HibernatePermission;
9
10 /**
11  * Comment
12  *
13  * @author <a HREF="mailto:kabir.khan@jboss.org">Kabir Khan</a>
14  */

15 public class JACCPreInsertEventListener extends DefaultPreInsertEventListener {
16     public boolean onPreInsert(PreInsertEvent event) {
17
18         EJBMethodPermission JavaDoc insertPermission = new EJBMethodPermission JavaDoc(
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