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

Gavin King gavin.king at jboss.com
Sat May 19 12:44:53 EDT 2007


  User: gavin   
  Date: 07/05/19 12:44:53

  Modified:    src/main/org/jboss/seam/pages  Page.java
  Log:
  add restore permission for pages
  
  Revision  Changes    Path
  1.18      +27 -8     jboss-seam/src/main/org/jboss/seam/pages/Page.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Page.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/pages/Page.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -b -r1.17 -r1.18
  --- Page.java	1 May 2007 16:43:52 -0000	1.17
  +++ Page.java	19 May 2007 16:44:53 -0000	1.18
  @@ -1,14 +1,18 @@
   package org.jboss.seam.pages;
  +
   import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.List;
   import java.util.Map;
   import java.util.MissingResourceException;
  +
   import javax.faces.context.FacesContext;
  +
   import org.jboss.seam.core.Interpolator;
   import org.jboss.seam.core.Locale;
   import org.jboss.seam.core.Pages;
   import org.jboss.seam.security.Identity;
  +
   /**
    * Metadata about page actions, page parameters, action navigation,
    * resource bundle, etc, for a particular JSF view id.
  @@ -188,24 +192,39 @@
      {
         return actions;
      }
  -   /**
  -    * Call page actions, in order they appear in XML, and
  -    * handle conversation begin/end 
  -    */
  -   public boolean enter(FacesContext facesContext)
  +   
  +   private void checkPermission(FacesContext facesContext, String name)
      {
         if ( isRestricted() )
         {
            // If no expression is configured, create a default one
            if (restriction == null)
            {
  -            Identity.instance().checkPermission( Pages.getViewId(facesContext), "render" );
  +            Identity.instance().checkPermission( Pages.getViewId(facesContext), name );
            }
            else
            {
               Identity.instance().checkRestriction(restriction);
            }
         }      
  +   }
  +   
  +   /**
  +    * Check the restore permission.
  +    */
  +   public void postRestore(FacesContext facesContext)
  +   {
  +      checkPermission(facesContext, "restore");
  +   }
  +
  +   /**
  +    * Call page actions, in order they appear in XML, and
  +    * handle conversation begin/end. Also check the 
  +    * render permission.
  +    */
  +   public boolean preRender(FacesContext facesContext)
  +   {
  +      checkPermission(facesContext, "render");     
         
         boolean result = false;
         
  @@ -237,8 +256,8 @@
         }
         
         return result;
  -   
      }
  +   
      public List<Input> getInputs()
      {
         return inputs;
  
  
  



More information about the jboss-cvs-commits mailing list