[seam-commits] Seam SVN: r8872 - trunk/src/main/org/jboss/seam/security.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Sep 1 18:50:56 EDT 2008


Author: shane.bryzak at jboss.com
Date: 2008-09-01 18:50:56 -0400 (Mon, 01 Sep 2008)
New Revision: 8872

Modified:
   trunk/src/main/org/jboss/seam/security/Identity.java
Log:
create systemOp on demand, fix serialization issue

Modified: trunk/src/main/org/jboss/seam/security/Identity.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/Identity.java	2008-09-01 21:43:28 UTC (rev 8871)
+++ trunk/src/main/org/jboss/seam/security/Identity.java	2008-09-01 22:50:56 UTC (rev 8872)
@@ -78,7 +78,7 @@
    
    private RememberMe rememberMe;
    
-   private transient ThreadLocal<Boolean> systemOp = new ThreadLocal<Boolean>();
+   private transient ThreadLocal<Boolean> systemOp;
    
    private String jaasConfigName = null;
    
@@ -412,7 +412,7 @@
    public boolean hasRole(String role)
    {
       if (!securityEnabled) return true;
-      if (systemOp.get() == Boolean.TRUE) return true;
+      if (systemOp != null && Boolean.TRUE.equals(systemOp.get())) return true;
       
       isLoggedIn(true);
       
@@ -524,7 +524,7 @@
     */
    public void checkPermission(String name, String action, Object...arg)
    {
-      if (systemOp.get() == Boolean.TRUE) return; 
+      if (systemOp != null && Boolean.TRUE.equals(systemOp.get())) return; 
       
       isLoggedIn(true);
       
@@ -546,7 +546,7 @@
    
    public void checkPermission(Object target, String action)
    {
-      if (systemOp.get() == Boolean.TRUE) return;
+      if (systemOp != null && Boolean.TRUE.equals(systemOp.get())) return;
       
       isLoggedIn(true);
       
@@ -577,7 +577,7 @@
    public boolean hasPermission(String name, String action, Object...arg)
    {      
       if (!securityEnabled) return true;
-      if (systemOp.get() == Boolean.TRUE) return true;     
+      if (systemOp != null && Boolean.TRUE.equals(systemOp.get())) return true;   
       if (permissionMapper == null) return false;
          
       if (arg != null)
@@ -598,7 +598,7 @@
    public boolean hasPermission(Object target, String action)
    {
       if (!securityEnabled) return true;
-      if (systemOp.get() == Boolean.TRUE) return true;      
+      if (systemOp != null && Boolean.TRUE.equals(systemOp.get())) return true;     
       if (permissionMapper == null) return false;
       if (target == null) return false;
       
@@ -706,6 +706,11 @@
          principal = operation.getPrincipal();
          subject = operation.getSubject();
          
+         if (systemOp == null)
+         {
+            systemOp = new ThreadLocal<Boolean>();
+         }
+         
          systemOp.set(operation.isSystemOperation());
          
          operation.execute();




More information about the seam-commits mailing list