[jboss-cvs] jboss-seam/src/main/org/jboss/seam/security ...

Shane Bryzak Shane_Bryzak at symantec.com
Tue Feb 13 10:13:12 EST 2007


  User: sbryzak2
  Date: 07/02/13 10:13:12

  Modified:    src/main/org/jboss/seam/security 
                        HibernateSecurityInterceptor.java
  Log:
  JBSEAM-841
  
  Revision  Changes    Path
  1.4       +20 -4     jboss-seam/src/main/org/jboss/seam/security/HibernateSecurityInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: HibernateSecurityInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/security/HibernateSecurityInterceptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- HibernateSecurityInterceptor.java	12 Feb 2007 08:05:35 -0000	1.3
  +++ HibernateSecurityInterceptor.java	13 Feb 2007 15:13:12 -0000	1.4
  @@ -8,6 +8,7 @@
   import java.io.Serializable;
   
   import org.hibernate.EmptyInterceptor;
  +import org.hibernate.Interceptor;
   import org.hibernate.type.Type;
   
   /**
  @@ -18,12 +19,21 @@
    */
   public class HibernateSecurityInterceptor extends EmptyInterceptor
   {
  +   private Interceptor wrappedInterceptor;
  +   
  +   public HibernateSecurityInterceptor(Interceptor wrappedInterceptor)
  +   {
  +      this.wrappedInterceptor = wrappedInterceptor;
  +   }
  +   
      @Override
      public boolean onLoad(Object entity, Serializable id, Object[] state,
                         String[] propertyNames, Type[] types)
      {
         Identity.instance().checkEntityPermission(entity, READ);
  -      return false;
  +      return wrappedInterceptor != null ? 
  +               wrappedInterceptor.onLoad(entity, id, state, propertyNames, types) : 
  +               false;
      }
      
      @Override
  @@ -31,6 +41,8 @@
                           String[] propertyNames, Type[] types)
      {
         Identity.instance().checkEntityPermission(entity, DELETE);      
  +      if (wrappedInterceptor != null)
  +         wrappedInterceptor.onDelete(entity, id, state, propertyNames, types);
      }
      
      @Override
  @@ -38,7 +50,9 @@
                      Object[] previousState, String[] propertyNames, Type[] types)
      {
         Identity.instance().checkEntityPermission(entity, UPDATE);
  -      return false;
  +      return wrappedInterceptor != null ? 
  +               wrappedInterceptor.onFlushDirty(entity, id, currentState, 
  +                        previousState, propertyNames, types) : false;
      }
      
      @Override
  @@ -46,6 +60,8 @@
                         String[] propertyNames, Type[] types)
      {
         Identity.instance().checkEntityPermission(entity, INSERT);      
  -      return false;
  +      return wrappedInterceptor != null ? 
  +               wrappedInterceptor.onSave(entity, id, state, propertyNames, types) : 
  +               false;
      }       
   }
  
  
  



More information about the jboss-cvs-commits mailing list