taylor      2004/03/29 13:38:43

  Modified:    src/java/org/apache/jetspeed/portal BasePortletSet.java
                        Portlet.java
               src/java/org/apache/jetspeed/portal/controls
                        VelocityPortletControl.java
               src/java/org/apache/jetspeed/portal/portlets
                        AbstractPortlet.java ContainerTestPortlet.java
               src/java/org/apache/jetspeed/portal/security/portlets
                        PortletWrapper.java
               src/java/org/apache/jetspeed/util/template JetspeedTool.java
               webapp/WEB-INF/conf JetspeedSecurity.properties
               xdocs    changes.xml
  Log:
  New feature to allow portlets to control whether the portlet and decorator is viewed
  This required a new method on the Portlet interface, getAllowView(RunData)
  This new method better fills out the obsoleting api; for some reason 'view' was 
missing from the interface
  where as 'edit' and 'info' were there. Perhaps a more general solution would mirror 
the Portlet API
  and make the modes and states parameterized
  
  Revision  Changes    Path
  1.35      +8 -1      
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSet.java
  
  Index: BasePortletSet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSet.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- BasePortletSet.java       23 Feb 2004 04:05:35 -0000      1.34
  +++ BasePortletSet.java       29 Mar 2004 21:38:42 -0000      1.35
  @@ -544,6 +544,13 @@
       }
   
       /**
  +     */
  +     public boolean getAllowView(RunData rundata)
  +     {
  +         return true;
  +     }
  +    
  +    /**
       */
       public boolean getAllowMaximize(RunData rundata)
       {
  
  
  
  1.48      +9 -1      
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/Portlet.java
  
  Index: Portlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/Portlet.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- Portlet.java      23 Feb 2004 04:05:35 -0000      1.47
  +++ Portlet.java      29 Mar 2004 21:38:42 -0000      1.48
  @@ -171,6 +171,14 @@
       public boolean getAllowEdit( RunData rundata );
   
       /**
  +    <p>Return true if this portlet is allowed to be viewed in the rundata's context 
.</p>
  +
  +    <p>Note:  PortletControl implementations should pay attention to this so
  +    that they don't allow this option if it returns false.</p>
  +    */
  +    public boolean getAllowView( RunData rundata );
  +    
  +    /**
       <p>Return true if this portlets is allowed to be maximized.</p>
   
       <p>Note:  PortletControl implementations should pay attention to this so
  
  
  
  1.30      +3 -3      
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/VelocityPortletControl.java
  
  Index: VelocityPortletControl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/VelocityPortletControl.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- VelocityPortletControl.java       29 Mar 2004 21:16:27 -0000      1.29
  +++ VelocityPortletControl.java       29 Mar 2004 21:38:42 -0000      1.30
  @@ -210,8 +210,8 @@
           {            
               // the portlet is state aware
               PortletState state = (PortletState)portlet;
  -            boolean customized = (jdata.getMode()==jdata.CUSTOMIZE);
  -            boolean maximized = customized||(jdata.getMode()==jdata.MAXIMIZE);
  +            boolean customized = (jdata.getMode()==JetspeedRunData.CUSTOMIZE);
  +            boolean maximized = 
customized||(jdata.getMode()==JetspeedRunData.MAXIMIZE);
               boolean infoAdded = false;
                       
               if ( state.allowCustomize( rundata ) )
  
  
  
  1.65      +28 -2     
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/AbstractPortlet.java
  
  Index: AbstractPortlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/AbstractPortlet.java,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- AbstractPortlet.java      23 Feb 2004 04:03:33 -0000      1.64
  +++ AbstractPortlet.java      29 Mar 2004 21:38:42 -0000      1.65
  @@ -577,10 +577,23 @@
        */
       public boolean getAllowEdit( RunData rundata )
       {
  -        return allowInfo( rundata );
  +        return allowCustomize(rundata);
       }
   
       /**
  +     * Is the portled viewable.
  +     * @param rundata The RunData object for the current request
  +     * @return <CODE>true</CODE> Viewing is allow
  +     * <CODE>false</CODE> Viewing is NOT alowed
  +     * 
  +     * Override this method to control your own View behavior
  +     */
  +    public boolean getAllowView( RunData rundata )
  +    {
  +        return allowView( rundata );
  +    }
  +    
  +    /**
        * Can this portlet be maximized
        * @param rundata The RunData object for the current request
        * @return <CODE>true</CODE> Portlet can be maximized<br>
  @@ -729,6 +742,19 @@
           return true;
       }
   
  +    /**
  +     * Implements the default view behavior:
  +     * security permissions will be checked.
  +     *
  +     * @param rundata The RunData object for the current request
  +     */
  +    public boolean allowView( RunData rundata )
  +    {
  +        //Security will not allow this call to succeed if there are
  +        //not enough permissions
  +        return true;
  +    }
  +    
       /**
        * Implements the default print friendly format behavior:
        * security permissions will be checked.
  
  
  
  1.9       +14 -1     
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/ContainerTestPortlet.java
  
  Index: ContainerTestPortlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/ContainerTestPortlet.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ContainerTestPortlet.java 23 Feb 2004 04:03:33 -0000      1.8
  +++ ContainerTestPortlet.java 29 Mar 2004 21:38:42 -0000      1.9
  @@ -422,5 +422,18 @@
           return true;
       }
   
  +    /**
  +     * Is the portled viewable.
  +     * @param rundata The RunData object for the current request
  +     * @return <CODE>true</CODE> Viewing is allow
  +     * <CODE>false</CODE> Viewing is NOT alowed
  +     * 
  +     * Override this method to control your own View behavior
  +     */
  +    public boolean getAllowView( RunData rundata )
  +    {
  +        return true;
  +    }
  +    
   
   }
  
  
  
  1.25      +7 -2      
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/security/portlets/PortletWrapper.java
  
  Index: PortletWrapper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/security/portlets/PortletWrapper.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- PortletWrapper.java       29 Mar 2004 21:02:29 -0000      1.24
  +++ PortletWrapper.java       29 Mar 2004 21:38:43 -0000      1.25
  @@ -213,7 +213,12 @@
        */
        public boolean getAllowView(RunData rundata)
        {
  -         return checkPermission(rundata, JetspeedSecurity.PERMISSION_VIEW);
  +
  +         if (checkPermission(rundata, JetspeedSecurity.PERMISSION_VIEW))
  +         {
  +             return wrappedPortlet.getAllowView(rundata);
  +         }
  +         return false;
        }
       
       /**
  
  
  
  1.38      +1 -2      
jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/JetspeedTool.java
  
  Index: JetspeedTool.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/JetspeedTool.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- JetspeedTool.java 23 Feb 2004 03:20:46 -0000      1.37
  +++ JetspeedTool.java 29 Mar 2004 21:38:43 -0000      1.38
  @@ -28,7 +28,6 @@
   import org.apache.jetspeed.portal.PortletControl;
   import org.apache.jetspeed.services.PortalToolkit;
   import org.apache.jetspeed.services.PortletFactory;
  -import org.apache.jetspeed.services.PsmlManager;
   import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
   import org.apache.jetspeed.services.logging.JetspeedLogger;
   import org.apache.jetspeed.services.resources.JetspeedResources;
  
  
  
  1.81      +0 -0      jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedSecurity.properties
  
  Index: JetspeedSecurity.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedSecurity.properties,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  
  
  
  1.184     +7 -1      jakarta-jetspeed/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/xdocs/changes.xml,v
  retrieving revision 1.183
  retrieving revision 1.184
  diff -u -r1.183 -r1.184
  --- changes.xml       23 Mar 2004 21:12:56 -0000      1.183
  +++ changes.xml       29 Mar 2004 21:38:43 -0000      1.184
  @@ -39,6 +39,12 @@
   </li>
   -->
   <li>
  +  Add -             - 2004/03/29 - New feature to hide portlet controls(decorators) 
if the portlet is not viewable (DST)
  +</li>
  +<li>
  +  Add -             - 2004/03/29 - New feature to allow portlets to control whether 
the portlet and decorator is viewed (DST)
  +</li>
  +<li>
     Add -             - 2004/03/11 - Added new Email portlet (DST)
   </li>
   <li>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to