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

Shane Bryzak sbryzak at redhat.com
Mon May 21 20:56:25 EDT 2007


  User: sbryzak2
  Date: 07/05/21 20:56:25

  Modified:    src/main/org/jboss/seam/security   
                        EntitySecurityListener.java
                        HibernateSecurityInterceptor.java Identity.java
  Log:
  JBSEAM-1114
  
  Revision  Changes    Path
  1.2       +16 -4     jboss-seam/src/main/org/jboss/seam/security/EntitySecurityListener.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: EntitySecurityListener.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/security/EntitySecurityListener.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- EntitySecurityListener.java	12 Feb 2007 06:16:08 -0000	1.1
  +++ EntitySecurityListener.java	22 May 2007 00:56:25 -0000	1.2
  @@ -21,24 +21,36 @@
      @PostLoad
      public void postLoad(Object entity)
      {
  +      if (Identity.isSecurityEnabled())
  +      {
         Identity.instance().checkEntityPermission(entity, READ);
      }
  +   }
      
      @PrePersist
      public void prePersist(Object entity)
      { 
  +      if (Identity.isSecurityEnabled())
  +      {
         Identity.instance().checkEntityPermission(entity, INSERT);
      }
  +   }
      
      @PreUpdate
      public void preUpdate(Object entity)
      {
  +      if (Identity.isSecurityEnabled())
  +      {
         Identity.instance().checkEntityPermission(entity, UPDATE);
      }
  +   }
      
      @PreRemove
      public void preRemove(Object entity)
      {
  +      if (Identity.isSecurityEnabled())
  +      {
         Identity.instance().checkEntityPermission(entity, DELETE);
      }
  +   }
   }
  
  
  
  1.5       +16 -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.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- HibernateSecurityInterceptor.java	13 Feb 2007 15:13:12 -0000	1.4
  +++ HibernateSecurityInterceptor.java	22 May 2007 00:56:25 -0000	1.5
  @@ -30,7 +30,10 @@
      public boolean onLoad(Object entity, Serializable id, Object[] state,
                         String[] propertyNames, Type[] types)
      {
  +      if (Identity.isSecurityEnabled())
  +      {
         Identity.instance().checkEntityPermission(entity, READ);
  +      }
         return wrappedInterceptor != null ? 
                  wrappedInterceptor.onLoad(entity, id, state, propertyNames, types) : 
                  false;
  @@ -40,7 +43,10 @@
      public void onDelete(Object entity, Serializable id, Object[] state, 
                           String[] propertyNames, Type[] types)
      {
  +      if (Identity.isSecurityEnabled())
  +      {
         Identity.instance().checkEntityPermission(entity, DELETE);   
  +      }
         if (wrappedInterceptor != null)
            wrappedInterceptor.onDelete(entity, id, state, propertyNames, types);
      }
  @@ -49,7 +55,10 @@
      public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState,
                      Object[] previousState, String[] propertyNames, Type[] types)
      {
  +      if (Identity.isSecurityEnabled())
  +      {
         Identity.instance().checkEntityPermission(entity, UPDATE);
  +      }
         return wrappedInterceptor != null ? 
                  wrappedInterceptor.onFlushDirty(entity, id, currentState, 
                           previousState, propertyNames, types) : false;
  @@ -59,7 +68,10 @@
      public boolean onSave(Object entity, Serializable id, Object[] state,
                         String[] propertyNames, Type[] types)
      {
  +      if (Identity.isSecurityEnabled())
  +      {
         Identity.instance().checkEntityPermission(entity, INSERT);      
  +      }
         return wrappedInterceptor != null ? 
                  wrappedInterceptor.onSave(entity, id, state, propertyNames, types) : 
                  false;
  
  
  
  1.80      +12 -0     jboss-seam/src/main/org/jboss/seam/security/Identity.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Identity.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/security/Identity.java,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -b -r1.79 -r1.80
  --- Identity.java	21 May 2007 03:47:38 -0000	1.79
  +++ Identity.java	22 May 2007 00:56:25 -0000	1.80
  @@ -51,6 +51,8 @@
   @Startup
   public class Identity extends Selector
   {  
  +   private static boolean securityEnabled = true;
  +   
      public static final String ROLES_GROUP = "Roles";
      
      private static final String LOGIN_TRIED = "org.jboss.seam.security.loginTried";
  @@ -84,6 +86,16 @@
         initCredentialsFromCookie();
      }
   
  +   public static boolean isSecurityEnabled()
  +   {
  +      return securityEnabled;
  +   }
  +   
  +   public static void setSecurityEnabled(boolean enabled)
  +   {
  +      securityEnabled = enabled;
  +   }
  +
      private void initCredentialsFromCookie()
      {
         username = getCookieValue();
  
  
  



More information about the jboss-cvs-commits mailing list