myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1079449 - /myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/security/SecurityAwareViewHandler.java
Date Tue, 08 Mar 2011 17:48:19 GMT
Author: gpetracek
Date: Tue Mar  8 17:48:19 2011
New Revision: 1079449

URL: http://svn.apache.org/viewvc?rev=1079449&view=rev
Log:
EXTCDI-149 support for special implementations of AccessDecisionVoter

Modified:
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/security/SecurityAwareViewHandler.java

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/security/SecurityAwareViewHandler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/security/SecurityAwareViewHandler.java?rev=1079449&r1=1079448&r2=1079449&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/security/SecurityAwareViewHandler.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/security/SecurityAwareViewHandler.java
Tue Mar  8 17:48:19 2011
@@ -71,6 +71,11 @@ public class SecurityAwareViewHandler ex
             return result;
         }
 
+        UIViewRoot originalViewRoot = context.getViewRoot();
+
+        //we have to use it as current view if an AccessDecisionVoter uses the JSF API to
check access to the view-id
+        context.setViewRoot(result);
+
         try
         {
             ViewConfigDescriptor entry = ViewConfigCache.getViewConfig(result.getViewId());
@@ -86,7 +91,7 @@ public class SecurityAwareViewHandler ex
                     errorView = ((EditableViewConfigDescriptor)entry).getErrorView();
                 }
 
-                invokeVoters(null, this.beanManager, entry.getAccessDecisionVoters(), errorView);
+                invokeVoters(null /*TODO*/, this.beanManager, entry.getAccessDecisionVoters(),
errorView);
             }
         }
         catch (AccessDeniedException accessDeniedException)
@@ -94,6 +99,13 @@ public class SecurityAwareViewHandler ex
             Class<? extends ViewConfig> errorView = SecurityUtils.getErrorView(accessDeniedException);
             return this.wrapped.createView(context, ViewConfigCache.getViewConfig(errorView).getViewId());
         }
+        finally
+        {
+            if(originalViewRoot != null)
+            {
+                context.setViewRoot(originalViewRoot);
+            }
+        }
 
         return result;
     }



Mime
View raw message