You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2004/05/15 04:08:10 UTC

cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager DeployUtilities.java

taylor      2004/05/14 19:08:10

  Modified:    portal/src/java/org/apache/jetspeed/engine/servlet
                        ServletRequestImpl.java
               portal/src/java/org/apache/jetspeed/tools/pamanager
                        DeployUtilities.java
  Log:
  patch from Ate Douma 
  change to web.xml processing of welcome file processing making not required
  im ok with it, but it changes the previous behavior
  if anyone has a problem with this change please speak up on the jetspeed-dev list
  
  
  PR:
  Obtained from:
  Submitted by:	
  Reviewed by:	
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.12      +48 -1     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/servlet/ServletRequestImpl.java
  
  Index: ServletRequestImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/servlet/ServletRequestImpl.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ServletRequestImpl.java	11 Apr 2004 04:07:42 -0000	1.11
  +++ ServletRequestImpl.java	15 May 2004 02:08:10 -0000	1.12
  @@ -26,6 +26,11 @@
   
   import org.apache.jetspeed.container.url.PortalURL;
   import org.apache.jetspeed.request.JetspeedRequestContext;
  +import org.apache.pluto.om.common.SecurityRole;
  +import org.apache.pluto.om.common.SecurityRoleRef;
  +import org.apache.pluto.om.common.SecurityRoleRefSet;
  +import org.apache.pluto.om.common.SecurityRoleSet;
  +import org.apache.pluto.om.portlet.PortletDefinition;
   import org.apache.pluto.om.window.PortletWindow;
   
   /**
  @@ -135,4 +140,46 @@
           return (String[]) this.getParameterMap().get(name);
       }
   
  +    /**
  +     * @see javax.servlet.http.HttpServletRequest#isUserInRole(java.lang.String)
  +     */
  +    public boolean isUserInRole(String roleName)
  +    {
  +        // will result in a NullPointerException if roleName == null which is
  +        // just as well I guess.
  +        if (roleName.length() > 0)
  +        {
  +            PortletDefinition portletDefinition = portletWindow
  +                    .getPortletEntity().getPortletDefinition();
  +            SecurityRoleRefSet roleRefSet = portletDefinition
  +                    .getInitSecurityRoleRefSet();
  +            SecurityRoleSet roleSet = portletDefinition
  +                    .getPortletApplicationDefinition()
  +                    .getWebApplicationDefinition().getSecurityRoles();
  +
  +            Iterator roleRefIter = roleRefSet.iterator();
  +            while (roleRefIter.hasNext())
  +            {
  +                SecurityRoleRef roleRef = (SecurityRoleRef) roleRefIter.next();
  +                if (roleName.equals(roleRef.getRoleName()))
  +                {
  +                    String roleLinkName = roleRef.getRoleLink();
  +                    if (roleLinkName == null || roleLinkName.length() == 0)
  +                    {
  +                        roleLinkName = roleName;
  +                    }
  +                    Iterator roleIter = roleSet.iterator();
  +                    while (roleIter.hasNext())
  +                    {
  +                        SecurityRole role = (SecurityRole) roleIter.next();
  +                        if (roleLinkName.equals(role.getRoleName()))
  +                                return super.isUserInRole(roleLinkName);
  +                    }
  +                    return false;
  +                }
  +
  +            }
  +        }
  +        return false;
  +    }
   }
  
  
  
  1.9       +30 -21    jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/DeployUtilities.java
  
  Index: DeployUtilities.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/DeployUtilities.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DeployUtilities.java	19 Apr 2004 18:38:40 -0000	1.8
  +++ DeployUtilities.java	15 May 2004 02:08:10 -0000	1.9
  @@ -256,26 +256,35 @@
   
               // Add the <welcome-file-list> node to the document
   
  -            if (bWelcomeFileExists == false)
  -            {
  -                log.info("Adding <welcome-file-list> element to web.xml...");
  -                bDocUpdated = true;
  -
  -                // Create Welcome-file node
  -                Element eWelcomeFile = doc.createElement("welcome-file");
  -                Text txt = doc.createTextNode("Index.jsp");
  -                eWelcomeFile.appendChild(txt);
  -
  -                // Create welcome-file-list node
  -                Element eWelcomeList = doc.createElement("welcome-file-list");
  -
  -                // Add welcome-file node to welcome-file-list node
  -                eWelcomeList.appendChild(eWelcomeFile);
  -
  -                // Add the welcome-file-list to the document
  -                doc.getDocumentElement().appendChild(eWelcomeList);
  -
  -            }
  +            // TODO: Investigate why a welcome file is needed.
  +            //       It's not needed for spec compliance and never used if the
  +            //       portlet is accessed as portlet as it should.
  +            //       The current implementation of adding a welcome file is wrong
  +            //       when other elements are defined in the web.xml which must be
  +            //       located AFTER the welcome file list. Just adding it to the
  +            //       end just won't do.
  +            //       For now, commented out adding one.
  +            //       2004-05-14: ate@douma.nu
  +//            if (bWelcomeFileExists == false)
  +//            {
  +//                log.info("Adding <welcome-file-list> element to web.xml...");
  +//                bDocUpdated = true;
  +//
  +//                // Create Welcome-file node
  +//                Element eWelcomeFile = doc.createElement("welcome-file");
  +//                Text txt = doc.createTextNode("Index.jsp");
  +//                eWelcomeFile.appendChild(txt);
  +//
  +//                // Create welcome-file-list node
  +//                Element eWelcomeList = doc.createElement("welcome-file-list");
  +//
  +//                // Add welcome-file node to welcome-file-list node
  +//                eWelcomeList.appendChild(eWelcomeFile);
  +//
  +//                // Add the welcome-file-list to the document
  +//                doc.getDocumentElement().appendChild(eWelcomeList);
  +//
  +//            }
   
               // Persit DOM Docuemnt to disk
               if (bDocUpdated == true)
  
  
  

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