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

Shane Bryzak Shane_Bryzak at symantec.com
Wed Jan 31 10:27:33 EST 2007


  User: sbryzak2
  Date: 07/01/31 10:27:33

  Modified:    src/main/org/jboss/seam/security   Identity.java
                        SecurityFunctions.java
  Log:
  use varargs param for Identity.hasPermission()
  
  Revision  Changes    Path
  1.36      +8 -8      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.35
  retrieving revision 1.36
  diff -u -b -r1.35 -r1.36
  --- Identity.java	31 Jan 2007 06:50:03 -0000	1.35
  +++ Identity.java	31 Jan 2007 15:27:33 -0000	1.36
  @@ -241,7 +241,7 @@
       * @param arg Object Optional object parameter used to make a permission decision
       * @return boolean True if the user has the specified permission
       */
  -   public boolean hasPermission(String name, String action, Object arg)
  +   public boolean hasPermission(String name, String action, Object...arg)
      {      
         List<FactHandle> handles = new ArrayList<FactHandle>();
   
  @@ -251,11 +251,11 @@
         {
            handles.add(securityContext.assertObject(check));
      
  -         if (arg!=null && securityContext.getFactHandle(arg) == null)
  +         for (int i = 0; i < arg.length; i++)
            {
  -            if (arg instanceof Collection)
  +            if (i == 0 && arg[0] instanceof Collection)
               {
  -               for (Object value : (Collection) arg)
  +               for (Object value : (Collection) arg[i])
                  {
                     if (securityContext.getFactHandle(value) == null)
                     {
  @@ -265,7 +265,7 @@
               }
               else
               {
  -               handles.add( securityContext.assertObject(arg) );
  +               handles.add(securityContext.assertObject(arg[i]));
               }
            }      
      
  
  
  
  1.3       +5 -3      jboss-seam/src/main/org/jboss/seam/security/SecurityFunctions.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SecurityFunctions.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/security/SecurityFunctions.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- SecurityFunctions.java	25 Jan 2007 13:21:37 -0000	1.2
  +++ SecurityFunctions.java	31 Jan 2007 15:27:33 -0000	1.3
  @@ -12,9 +12,11 @@
         return Identity.instance().hasRole(name);
      }
      
  -   public static boolean hasPermission(String name, String action,
  -            Object arg)
  +   public static boolean hasPermission(String name, String action, Object arg)
      {
  +      if (arg != null)
         return Identity.instance().hasPermission(name, action, arg);
  +      else
  +         return Identity.instance().hasPermission(name, action);
      }
   }
  
  
  



More information about the jboss-cvs-commits mailing list