portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/services/portaltoolkit JetspeedPortalToolkitService.java
Date Mon, 29 Mar 2004 21:02:29 GMT
taylor      2004/03/29 13:02:29

  Modified:    src/java/org/apache/jetspeed/portal/controls
                        AbstractPortletControl.java
                        VelocityPortletControl.java
               src/java/org/apache/jetspeed/portal/security/portlets
                        PortletWrapper.java
               src/java/org/apache/jetspeed/services/portaltoolkit
                        JetspeedPortalToolkitService.java
  Log:
  Enhancement to NOT display the control decorator in view mode if the
  current security context does not allow access to the portlet
  I will next make this check optional for backward compatibility
  
  Revision  Changes    Path
  1.21      +22 -3     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/AbstractPortletControl.java
  
  Index: AbstractPortletControl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/AbstractPortletControl.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- AbstractPortletControl.java	23 Feb 2004 03:25:35 -0000	1.20
  +++ AbstractPortletControl.java	29 Mar 2004 21:02:29 -0000	1.21
  @@ -33,6 +33,7 @@
   import org.apache.jetspeed.portal.PortletController;
   import org.apache.jetspeed.portal.PortletException;
   import org.apache.jetspeed.portal.portlets.AbstractPortlet;
  +import org.apache.jetspeed.portal.security.portlets.PortletWrapper;
   import org.apache.jetspeed.services.Registry;
   import org.apache.jetspeed.services.JetspeedSecurity;
   import org.apache.jetspeed.util.MimeType;
  @@ -43,6 +44,7 @@
   // ECS imports
   import org.apache.ecs.ElementContainer;
   import org.apache.ecs.ConcreteElement;
  +import org.apache.ecs.StringElement;
   
   /**
    * The PortletControl acts both as a decoration around a Portlet or PortletSet
  @@ -332,8 +334,25 @@
        */
       public ConcreteElement getContent(RunData rundata)
       {
  -        if (getPortlet()==null) return new ElementContainer();
  -        return getPortlet().getContent( rundata );
  +        Portlet portlet = getPortlet(); 
  +        if (portlet == null)
  +        {
  +            return new ElementContainer();
  +        }
  +        
  +        // Check to see if the portlet allows view
  +        // If the current security context disallows view,
  +        // do not display the portlet OR the control decorator
  +        if (portlet instanceof PortletWrapper)
  +        {
  +            PortletWrapper wrapper = (PortletWrapper)portlet;
  +            if (!wrapper.getAllowView(rundata))
  +            {
  +                return new StringElement("");                
  +            }
  +        }
  +        
  +        return portlet.getContent( rundata );
       }
   
       /**
  
  
  
  1.28      +14 -1     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.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- VelocityPortletControl.java	23 Mar 2004 21:08:14 -0000	1.27
  +++ VelocityPortletControl.java	29 Mar 2004 21:02:29 -0000	1.28
  @@ -24,6 +24,7 @@
   // Jetspeed stuff
   import org.apache.jetspeed.portal.Portlet;
   import org.apache.jetspeed.portal.PortletState;
  +import org.apache.jetspeed.portal.security.portlets.PortletWrapper;
   import org.apache.jetspeed.services.TemplateLocator;
   import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
   import org.apache.jetspeed.services.logging.JetspeedLogger;
  @@ -94,6 +95,18 @@
       {
           Portlet portlet = getPortlet();
           JetspeedRunData jdata = (JetspeedRunData)rundata;
  +        
  +        // Check to see if the portlet allows view
  +        // If the current security context disallows view,
  +        // do not display the portlet OR the control decorator
  +        if (portlet instanceof PortletWrapper)
  +        {
  +            PortletWrapper wrapper = (PortletWrapper)portlet;
  +            if (!wrapper.getAllowView(rundata))
  +            {
  +                return new StringElement("");                
  +            }
  +        }
   
           // Create a new Velocity context and load default 
           // application pull tools
  
  
  
  1.24      +8 -1      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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- PortletWrapper.java	23 Feb 2004 03:27:46 -0000	1.23
  +++ PortletWrapper.java	29 Mar 2004 21:02:29 -0000	1.24
  @@ -210,6 +210,13 @@
       }
   
       /**
  +     */
  +     public boolean getAllowView(RunData rundata)
  +     {
  +         return checkPermission(rundata, JetspeedSecurity.PERMISSION_VIEW);
  +     }
  +    
  +    /**
       */
       public boolean getAllowMaximize(RunData rundata)
       {
  
  
  
  1.33      +2 -2      jakarta-jetspeed/src/java/org/apache/jetspeed/services/portaltoolkit/JetspeedPortalToolkitService.java
  
  Index: JetspeedPortalToolkitService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/portaltoolkit/JetspeedPortalToolkitService.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- JetspeedPortalToolkitService.java	23 Feb 2004 03:34:14 -0000	1.32
  +++ JetspeedPortalToolkitService.java	29 Mar 2004 21:02:29 -0000	1.33
  @@ -513,7 +513,7 @@
       }
   
       /**
  -     * Associates a PortletControl wit an existing Portlet and
  +     * Associates a PortletControl with an existing Portlet and
        * returns the Control
        *
        * @param pc the existing PortletControl
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message