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-2/jetspeed-api/src/java/org/apache/jetspeed/om/folder Folder.java
Date Tue, 23 Nov 2004 00:01:32 GMT
taylor      2004/11/22 16:01:32

  Modified:    components/page-manager/src/java/org/apache/jetspeed/page/document
                        FileSystemFolderHandler.java
                        CastorFileSystemDocumentHandler.java
                        AbstractNode.java
               jetspeed-api/src/java/org/apache/jetspeed/page/document
                        NodeSet.java
               components/page-manager/src/java/org/apache/jetspeed/om/folder/impl
                        FolderMetaDataImpl.java FolderImpl.java
               components/page-manager/src/java/org/apache/jetspeed/om/page/psml
                        AbstractBaseElement.java
               components/page-manager/src/java/org/apache/jetspeed/page/impl
                        CastorXmlPageManager.java AbstractPageManager.java
               jetspeed-api/src/java/org/apache/jetspeed/om/folder
                        Folder.java
  Log:
  patch from Randy Watler
  
  The security checks implemented on the PageManager and Folder element accessors are as follows:
  
  - All folder and page.security document read access is always granted to facilitate navigation.
  - Pages, links, and document set documents are checked for "view" access on read.
  - Page update/register/remove usage is checked for "edit" access.
  
  Revision  Changes    Path
  1.5       +8 -8      jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/document/FileSystemFolderHandler.java
  
  Index: FileSystemFolderHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/document/FileSystemFolderHandler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FileSystemFolderHandler.java	21 Oct 2004 02:28:07 -0000	1.4
  +++ FileSystemFolderHandler.java	23 Nov 2004 00:01:31 -0000	1.5
  @@ -384,7 +384,7 @@
               if (regexp)
               {
                   // get regexp matched folders
  -                matchedFolders = folder.getFolders().inclusiveSubset(folderPath);
  +                matchedFolders = ((FolderImpl)folder).getFolders(false).inclusiveSubset(folderPath);
               }
               else
               {
  @@ -418,7 +418,7 @@
           if (regexp)
           {
               // get regexp matched nodes
  -            Iterator addIter = folder.getAllNodes().inclusiveSubset(nodePath).iterator();
  +            Iterator addIter = ((FolderImpl)folder).getAllNodes().inclusiveSubset(nodePath).iterator();
               while (addIter.hasNext())
               {
                   matched.add((Node) addIter.next());
  @@ -427,7 +427,7 @@
           else
           {
               // get single matched node
  -            Iterator findIter = folder.getAllNodes().iterator();
  +            Iterator findIter = ((FolderImpl)folder).getAllNodes().iterator();
               while (findIter.hasNext())
               {
                   Node addNode = (Node) findIter.next();
  @@ -486,18 +486,18 @@
           {
               Folder folder = (Folder) entry.getDocument();            
               entry.setDocument(getFolder(folder.getPath(), false));
  -            if(folder.getParent() != null)
  +            if (((AbstractNode)folder).getParent(false) != null)
               {
  -                FileCacheEntry parentEntry = (FileCacheEntry)fileCache.get(folder.getParent().getPath());
  +                FileCacheEntry parentEntry = (FileCacheEntry)fileCache.get(((AbstractNode)folder).getParent(false).getPath());
                   refresh(parentEntry);                
               }
           }
           else if(entry.getDocument() instanceof Document)
           {
               Document doc = (Document) entry.getDocument();
  -            if(doc.getType().equals(FolderMetaData.DOCUMENT_TYPE))
  +            if (doc.getType().equals(FolderMetaData.DOCUMENT_TYPE))
               {
  -                FileCacheEntry folderEntry = fileCache.get(doc.getParent().getPath());
  +                FileCacheEntry folderEntry = fileCache.get(((AbstractNode)doc).getParent().getPath());
                   refresh(folderEntry);
               }
           }
  
  
  
  1.9       +5 -5      jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/document/CastorFileSystemDocumentHandler.java
  
  Index: CastorFileSystemDocumentHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/document/CastorFileSystemDocumentHandler.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- CastorFileSystemDocumentHandler.java	19 Nov 2004 03:06:44 -0000	1.8
  +++ CastorFileSystemDocumentHandler.java	23 Nov 2004 00:01:31 -0000	1.9
  @@ -30,7 +30,7 @@
   import org.apache.jetspeed.cache.file.FileCache;
   import org.apache.jetspeed.cache.file.FileCacheEntry;
   import org.apache.jetspeed.cache.file.FileCacheEventListener;
  -import org.apache.jetspeed.om.folder.Folder;
  +import org.apache.jetspeed.om.folder.impl.FolderImpl;
   import org.apache.jetspeed.om.page.Document;
   import org.apache.jetspeed.om.page.psml.AbstractBaseElement;
   import org.apache.jetspeed.page.PageNotFoundException;
  @@ -452,12 +452,12 @@
           {
               Document document = (Document) entry.getDocument();
               Document freshDoc = getDocument(document.getPath(), false);
  -            Node parent = document.getParent();
  +            Node parent = ((AbstractNode)document).getParent(false);
    
               freshDoc.setParent(parent);
  -            if(parent instanceof Folder)
  +            if(parent instanceof FolderImpl)
               {
  -                Folder folder = (Folder) parent;
  +                FolderImpl folder = (FolderImpl) parent;
                   folder.getAllNodes().add(freshDoc);
               }
               
  
  
  
  1.8       +31 -9     jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/document/AbstractNode.java
  
  Index: AbstractNode.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/document/AbstractNode.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AbstractNode.java	19 Nov 2004 03:06:44 -0000	1.7
  +++ AbstractNode.java	23 Nov 2004 00:01:31 -0000	1.8
  @@ -25,6 +25,7 @@
   
   import org.apache.jetspeed.om.common.GenericMetadata;
   import org.apache.jetspeed.om.common.LocalizedField;
  +import org.apache.jetspeed.om.common.SecuredResource;
   import org.apache.jetspeed.om.common.SecurityConstraints;
   import org.apache.jetspeed.om.page.psml.AbstractBaseElement;
   import org.apache.jetspeed.om.page.psml.PageMetadataImpl;
  @@ -197,12 +198,33 @@
        * getParent
        * </p>
        * 
  -     * @see org.apache.jetspeed.om.folder.ChildNode#getParent()
  +     * @param checkAccess flag
  +     * @return parent node
  +     */
  +    public Node getParent(boolean checkAccess)
  +    {
  +        AbstractNode parent = (AbstractNode) this.parent;
  +
  +        // check access
  +        if ((parent != null) && checkAccess)
  +        {
  +            parent.checkAccess(SecuredResource.VIEW_ACTION);
  +        }
  +        return parent;
  +    }
  +
  +    /**
  +     * <p>
  +     * getParent
  +     * </p>
  +     * 
  +     * @see org.apache.jetspeed.page.document.Node#getParent()
        * @return
        */
       public Node getParent()
       {
  -        return parent;
  +        // by default disable access checks to facilitate navigation
  +        return getParent(false);
       }
   
       /**
  @@ -210,7 +232,7 @@
        * setParent
        * </p>
        * 
  -     * @see org.apache.jetspeed.om.folder.ChildNode#setParent(org.apache.jetspeed.om.folder.Folder)
  +     * @see org.apache.jetspeed.page.document.Node#setParent(org.apache.jetspeed.om.folder.Folder)
        * @param parent
        */
       public void setParent( Node parent )
  @@ -220,26 +242,26 @@
   
       /**
        * <p>
  -     * getRelativeName
  +     * getName
        * </p>
        *
  -     * @see org.apache.jetspeed.om.folder.ChildNode#getRelativeName()
  +     * @see org.apache.jetspeed.page.document.Node#getName()
        * @return
        */
       public String getName()
       {
           String path = getPath();
           String parentName = "";
  -        if(getParent() != null)
  +        if(getParent(false) != null)
           {
  -            parentName = getParent().getPath();
  +            parentName = getParent(false).getPath();
               if (! parentName.endsWith(PATH_SEPARATOR))
               {
                   parentName += PATH_SEPARATOR;
               }
           }
           
  -        if(path.indexOf(parentName) > -1)
  +        if (path.startsWith(parentName))
           {
               return path.substring(parentName.length());
           }
  
  
  
  1.4       +2 -3      jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/page/document/NodeSet.java
  
  Index: NodeSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/page/document/NodeSet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NodeSet.java	15 Oct 2004 07:07:49 -0000	1.3
  +++ NodeSet.java	23 Nov 2004 00:01:31 -0000	1.4
  @@ -35,7 +35,7 @@
   
       /**
        * <p>
  -     * getNode
  +     * get
        * </p>     
        * Returns a Node based on <code>name</code>. <code>name</code>
        * can either be the fully quallified path, <code>folder1/folder2/myPage.psml</code>
  @@ -56,5 +56,4 @@
       NodeSet exclusiveSubset(String regex);
   
       int size();
  -
   }
  
  
  
  1.6       +2 -2      jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMetaDataImpl.java
  
  Index: FolderMetaDataImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMetaDataImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FolderMetaDataImpl.java	21 Oct 2004 02:28:07 -0000	1.5
  +++ FolderMetaDataImpl.java	23 Nov 2004 00:01:31 -0000	1.6
  @@ -66,7 +66,7 @@
       public String getUrl()
       {
          
  -        return getParent().getPath() + PATH_SEPARATOR + getType();
  +        return getParent(false).getPath() + PATH_SEPARATOR + getType();
       }
       /**
        * <p>
  
  
  
  1.20      +287 -15   jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderImpl.java
  
  Index: FolderImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderImpl.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- FolderImpl.java	19 Nov 2004 03:06:44 -0000	1.19
  +++ FolderImpl.java	23 Nov 2004 00:01:31 -0000	1.20
  @@ -23,6 +23,7 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.jetspeed.om.common.GenericMetadata;
  +import org.apache.jetspeed.om.common.SecuredResource;
   import org.apache.jetspeed.om.common.SecurityConstraints;
   import org.apache.jetspeed.om.folder.DocumentSet;
   import org.apache.jetspeed.om.folder.Folder;
  @@ -30,10 +31,12 @@
   import org.apache.jetspeed.om.folder.FolderNotFoundException;
   import org.apache.jetspeed.om.page.Link;
   import org.apache.jetspeed.om.page.Page;
  +import org.apache.jetspeed.om.page.PageSecurity;
   import org.apache.jetspeed.page.PageNotFoundException;
   import org.apache.jetspeed.page.document.AbstractNode;
   import org.apache.jetspeed.page.document.DocumentException;
   import org.apache.jetspeed.page.document.DocumentHandlerFactory;
  +import org.apache.jetspeed.page.document.DocumentNotFoundException;
   import org.apache.jetspeed.page.document.FolderHandler;
   import org.apache.jetspeed.page.document.Node;
   import org.apache.jetspeed.page.document.NodeException;
  @@ -106,7 +109,7 @@
               {
                   defaultPage = FALLBACK_DEFAULT_PAGE;
               }
  -            return getPage(defaultPage).getName();
  +            return getPage(defaultPage, false).getName();
           }
           catch (NodeException e)
           {
  @@ -114,7 +117,7 @@
               {
                   try
                   {
  -                    Iterator pagesIter = getPages().iterator();
  +                    Iterator pagesIter = getPages(false).iterator();
                       if (pagesIter.hasNext())
                       {
                           return ((Page) pagesIter.next()).getName();
  @@ -163,6 +166,29 @@
           this.defaultTheme = defaultTheme;
       }
   
  +    /**
  +     * <p>
  +     * getFolders
  +     * </p>
  +     * 
  +     * @param checkAccess flag
  +     * @return folders node set
  +     * @throws FolderNotFoundException
  +     * @throws DocumentException
  +     */
  +    public NodeSet getFolders(boolean checkAccess) throws FolderNotFoundException, DocumentException
  +    {
  +        // get list of all folders
  +        NodeSet folders = getAllNodes().subset(Folder.FOLDER_TYPE);
  +
  +        // filter node set by access
  +        if (checkAccess)
  +        {
  +            folders = checkAccess(folders, SecuredResource.VIEW_ACTION);
  +        }
  +        return folders;
  +    }
  +
       /*
        * (non-Javadoc)
        * 
  @@ -170,7 +196,69 @@
        */
       public NodeSet getFolders() throws FolderNotFoundException, DocumentException
       {
  -        return getAllNodes().subset(Folder.FOLDER_TYPE);
  +        // by default disable access checks to facilitate navigation
  +        return getFolders(false);
  +    }
  +
  +    /**
  +     * <p>
  +     * getFolder
  +     * </p>
  +     * 
  +     * @param name
  +     * @param checkAccess flag
  +     * @return folder
  +     * @throws FolderNotFoundException
  +     * @throws DocumentException
  +     */
  +    public Folder getFolder(String name, boolean checkAccess) throws FolderNotFoundException, DocumentException
  +    {
  +        // get folder
  +        Folder folder = (Folder) getAllNodes().subset(Folder.FOLDER_TYPE).get(name);
  +        if (folder == null)
  +        {
  +            throw new FolderNotFoundException("Jetspeed PSML folder not found: " + name);
  +        }
  +
  +        // check access
  +        if (checkAccess)
  +        {
  +            folder.checkAccess(SecuredResource.VIEW_ACTION);
  +        }
  +        return folder;
  +    }
  +
  +    /*
  +     * (non-Javadoc)
  +     * 
  +     * @see org.apache.jetspeed.om.folder.Folder#getFolder(java.lang.String)
  +     */
  +    public Folder getFolder(String name) throws FolderNotFoundException, DocumentException
  +    {
  +        // by default disable access checks to facilitate navigation
  +        return getFolder(name, false);
  +    }
  +
  +    /**
  +     * <p>
  +     * getPages
  +     * </p>
  +     * 
  +     * @param checkAccess flag
  +     * @return pages node set
  +     * @throws NodeException
  +     */
  +    public NodeSet getPages(boolean checkAccess) throws NodeException
  +    {
  +        // get list of all pages
  +        NodeSet pages = getAllNodes().subset(Page.DOCUMENT_TYPE);
  +
  +        // filter node set by access
  +        if (checkAccess)
  +        {
  +            pages = checkAccess(pages, SecuredResource.VIEW_ACTION);
  +        }
  +        return pages;
       }
   
       /*
  @@ -180,31 +268,119 @@
        */
       public NodeSet getPages() throws NodeException
       {
  -        return getAllNodes().subset(Page.DOCUMENT_TYPE);
  +        // by default enable access checks
  +        return getPages(true);
       }
   
  -    public Page getPage( String name ) throws PageNotFoundException, NodeException
  +    /**
  +     * <p>
  +     * getPage
  +     * </p>
  +     * 
  +     * @param name
  +     * @param checkAccess flag
  +     * @return page
  +     * @throws PageNotFoundException
  +     * @throws NodeException
  +     */
  +    public Page getPage(String name, boolean checkAccess) throws PageNotFoundException, NodeException
       {
  -        Page page = (Page) getPages().get(name);
  +        // get page
  +        Page page = (Page) getAllNodes().subset(Page.DOCUMENT_TYPE).get(name);
           if (page == null)
           {
               throw new PageNotFoundException("Jetspeed PSML page not found: " + name);
           }
  +
  +        // check access
  +        if (checkAccess)
  +        {
  +            page.checkAccess(SecuredResource.VIEW_ACTION);
  +        }
           return page;
       }
   
  +    /*
  +     * (non-Javadoc)
  +     * 
  +     * @see org.apache.jetspeed.om.folder.Folder#getPage(java.lang.String)
  +     */
  +    public Page getPage(String name) throws PageNotFoundException, NodeException
  +    {
  +        // by default enable access checks
  +        return getPage(name, true);
  +    }
  +
       /**
        * <p>
        * getLinks
        * </p>
        * 
  +     * @param checkAccess flag
  +     * @return links node set
  +     * @throws NodeException
  +     */
  +    public NodeSet getLinks(boolean checkAccess) throws NodeException
  +    {
  +        // get list of all links
  +        NodeSet links = getAllNodes().subset(Link.DOCUMENT_TYPE);
  +
  +        // filter node set by access
  +        if (checkAccess)
  +        {
  +            links = checkAccess(links, SecuredResource.VIEW_ACTION);
  +        }
  +        return links;
  +    }
  +
  +    /*
  +     * (non-Javadoc)
  +     * 
        * @see org.apache.jetspeed.om.folder.Folder#getLinks()
  -     * @return @throws
  -     *         DocumentNotFoundException
        */
       public NodeSet getLinks() throws NodeException
       {
  -        return getAllNodes().subset(Link.DOCUMENT_TYPE);
  +        // by default enable access checks
  +        return getLinks(true);
  +    }
  +
  +    /**
  +     * <p>
  +     * getLink
  +     * </p>
  +     * 
  +     * @param name
  +     * @param checkAccess flag
  +     * @return link
  +     * @throws DocumentNotFoundException
  +     * @throws NodeException
  +     */
  +    public Link getLink(String name, boolean checkAccess) throws DocumentNotFoundException, NodeException
  +    {
  +        // get link
  +        Link link = (Link) getAllNodes().subset(Link.DOCUMENT_TYPE).get(name);
  +        if (link == null)
  +        {
  +            throw new DocumentNotFoundException("Jetspeed PSML link not found: " + name);
  +        }
  +
  +        // check access
  +        if (checkAccess)
  +        {
  +            link.checkAccess(SecuredResource.VIEW_ACTION);
  +        }
  +        return link;
  +    }
  +
  +    /*
  +     * (non-Javadoc)
  +     * 
  +     * @see org.apache.jetspeed.om.folder.Folder#getLink(java.lang.String)
  +     */
  +    public Link getLink(String name) throws DocumentNotFoundException, NodeException
  +    {
  +        // by default enable access checks
  +        return getLink(name, true);
       }
   
       /**
  @@ -212,13 +388,110 @@
        * getDocumentSets
        * </p>
        * 
  +     * @param checkAccess flag
  +     * @return documentSets node set
  +     * @throws NodeException
  +     */
  +    public NodeSet getDocumentSets(boolean checkAccess) throws NodeException
  +    {
  +        // get list of all documentSets
  +        NodeSet documentSets = getAllNodes().subset(DocumentSet.DOCUMENT_TYPE);
  +
  +        // filter node set by access
  +        if (checkAccess)
  +        {
  +            documentSets = checkAccess(documentSets, SecuredResource.VIEW_ACTION);
  +        }
  +        return documentSets;
  +    }
  +
  +    /*
  +     * (non-Javadoc)
  +     * 
        * @see org.apache.jetspeed.om.folder.Folder#getDocumentSets()
  -     * @return @throws
  -     *         DocumentNotFoundException
        */
       public NodeSet getDocumentSets() throws NodeException
       {
  -        return getAllNodes().subset(DocumentSet.DOCUMENT_TYPE);
  +        // by default enable access checks
  +        return getDocumentSets(true);
  +    }
  +
  +    /**
  +     * <p>
  +     * getDocumentSet
  +     * </p>
  +     * 
  +     * @param name
  +     * @param checkAccess flag
  +     * @return document set
  +     * @throws DocumentNotFoundException
  +     * @throws NodeException
  +     */
  +    public DocumentSet getDocumentSet(String name, boolean checkAccess) throws DocumentNotFoundException, NodeException
  +    {
  +        // get documentSet
  +        DocumentSet documentSet = (DocumentSet) getAllNodes().subset(DocumentSet.DOCUMENT_TYPE).get(name);
  +        if (documentSet == null)
  +        {
  +            throw new DocumentNotFoundException("Jetspeed PSML document set not found: " + name);
  +        }
  +
  +        // check access
  +        if (checkAccess)
  +        {
  +            documentSet.checkAccess(SecuredResource.VIEW_ACTION);
  +        }
  +        return documentSet;
  +    }
  +
  +    /*
  +     * (non-Javadoc)
  +     * 
  +     * @see org.apache.jetspeed.om.folder.Folder#getDocumentSet(java.lang.String)
  +     */
  +    public DocumentSet getDocumentSet(String name) throws DocumentNotFoundException, NodeException
  +    {
  +        // by default enable access checks
  +        return getDocumentSet(name, true);
  +    }
  +
  +    /**
  +     * <p>
  +     * getPageSecurity
  +     * </p>
  +     * 
  +     * @param checkAccess flag
  +     * @return page security
  +     * @throws DocumentNotFoundException
  +     * @throws NodeException
  +     */
  +    public PageSecurity getPageSecurity(boolean checkAccess) throws DocumentNotFoundException, NodeException
  +    {
  +        // check access to this folder in place
  +        // of access to page security document
  +        if (checkAccess)
  +        {
  +            checkAccess(SecuredResource.VIEW_ACTION);
  +        }
  +
  +        // get pageSecurity
  +        PageSecurity pageSecurity = (PageSecurity) getAllNodes().subset(PageSecurity.DOCUMENT_TYPE).get(PageSecurity.DOCUMENT_TYPE);
  +        if (pageSecurity == null)
  +        {
  +            throw new DocumentNotFoundException("Jetspeed PSML page security not found: " + PageSecurity.DOCUMENT_TYPE);
  +        }
  +        return pageSecurity;
  +    }
  +
  +    /*
  +     * (non-Javadoc)
  +     * 
  +     * @see org.apache.jetspeed.om.folder.Folder#getPageSecurity()
  +     */
  +    public PageSecurity getPageSecurity() throws DocumentNotFoundException, NodeException
  +    {
  +        // by default disable access checks
  +        return getPageSecurity(false);
       }
   
       /**
  @@ -239,8 +512,7 @@
        * getAllNodes
        * </p>
        *
  -     * @see org.apache.jetspeed.om.folder.Folder#getAllNodes()
  -     * @return
  +     * @return all nodes immediatley under this
        * @throws DocumentException
        * @throws FolderNotFoundException
        */
  
  
  
  1.6       +69 -1     jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/AbstractBaseElement.java
  
  Index: AbstractBaseElement.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/AbstractBaseElement.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractBaseElement.java	19 Nov 2004 03:06:43 -0000	1.5
  +++ AbstractBaseElement.java	23 Nov 2004 00:01:31 -0000	1.6
  @@ -30,6 +30,9 @@
   import org.apache.jetspeed.om.common.SecurityConstraints;
   import org.apache.jetspeed.om.page.BaseElement;
   import org.apache.jetspeed.page.document.DocumentHandlerFactory;
  +import org.apache.jetspeed.page.document.Node;
  +import org.apache.jetspeed.page.document.NodeSet;
  +import org.apache.jetspeed.page.document.NodeSetImpl;
   import org.apache.jetspeed.security.FolderPermission;
   import org.apache.jetspeed.security.GroupPrincipal;
   import org.apache.jetspeed.security.PagePermission;
  @@ -484,5 +487,70 @@
       public String toString()
       {      
           return getId();
  +    }
  +
  +    /**
  +     * <p>
  +     * checkAccess
  +     * </p>
  +     *
  +     * @param nodes
  +     * @param actions
  +     * @return
  +     */
  +    public static NodeSet checkAccess(NodeSet nodes, String actions)
  +    {
  +        if ((nodes != null) && (nodes.size() > 0))
  +        {
  +            // check permissions and constraints, filter nodes as required
  +            NodeSetImpl filteredNodes = null;
  +            Iterator checkAccessIter = nodes.iterator();
  +            while (checkAccessIter.hasNext())
  +            {
  +                AbstractBaseElement node = (AbstractBaseElement)checkAccessIter.next();
  +                try
  +                {
  +                    // check access
  +                    node.checkAccess(actions);
  +
  +                    // add to filteredNodes nodes if copying
  +                    if (filteredNodes != null)
  +                    {
  +                        // permitted, add to filteredNodes nodes
  +                        filteredNodes.add((Node)node);
  +                    }
  +                }
  +                catch (SecurityException se)
  +                {
  +                    // create filteredNodes nodes if not already copying
  +                    if (filteredNodes == null)
  +                    {
  +                        // not permitted, copy previously permitted nodes
  +                        // to new filteredNodes node set with same comparator
  +                        filteredNodes = new NodeSetImpl(null, ((NodeSetImpl) nodes).getComparator());
  +                        Iterator copyIter = nodes.iterator();
  +                        while (copyIter.hasNext())
  +                        {
  +                            Node copyNode = (Node)copyIter.next();
  +                            if (copyNode != node)
  +                            {
  +                                filteredNodes.add(copyNode);
  +                            }
  +                            else
  +                            {
  +                                break;
  +                            }
  +                        }
  +                    }
  +                }
  +            }
  +
  +            // return filteredNodes nodes if generated
  +            if (filteredNodes != null)
  +            {
  +                return filteredNodes;
  +            }
  +        }
  +        return nodes;
       }
   }
  
  
  
  1.23      +96 -88    jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/CastorXmlPageManager.java
  
  Index: CastorXmlPageManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/CastorXmlPageManager.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- CastorXmlPageManager.java	19 Nov 2004 03:06:44 -0000	1.22
  +++ CastorXmlPageManager.java	23 Nov 2004 00:01:31 -0000	1.23
  @@ -38,6 +38,7 @@
   import org.apache.jetspeed.cache.file.FileCacheEventListener;
   import org.apache.jetspeed.exception.JetspeedException;
   import org.apache.jetspeed.idgenerator.IdGenerator;
  +import org.apache.jetspeed.om.common.SecuredResource;
   import org.apache.jetspeed.om.folder.DocumentSet;
   import org.apache.jetspeed.om.folder.DocumentSetPath;
   import org.apache.jetspeed.om.folder.Folder;
  @@ -259,8 +260,8 @@
                   foldersIter = profiledFolders.iterator();
                   while (foldersIter.hasNext())
                   {
  -                    Folder aggregatePagesFolder = (Folder) foldersIter.next();
  -                    NodeSet aggregatePages = aggregatePagesFolder.getPages();
  +                    FolderImpl aggregatePagesFolder = (FolderImpl) foldersIter.next();
  +                    NodeSet aggregatePages = aggregatePagesFolder.getPages(false);
                       Iterator aggregatePagesIter = aggregatePages.iterator();
                       while (aggregatePagesIter.hasNext())
                       {
  @@ -269,9 +270,10 @@
                   }
   
                   // profile parent folder using profiled parent
  -                if ((folder.getParent() != null) && ! ((AbstractNode) folder).getProfiledPath().equals(Folder.PATH_SEPARATOR))
  +                if ((((AbstractNode)folder).getParent(false) != null) &&
  +                    !((AbstractNode)folder).getProfiledPath().equals(Folder.PATH_SEPARATOR))
                   {
  -                    parentFolder = (Folder) setProfiledNodePathAndUrl((AbstractNode) folder.getParent());
  +                    parentFolder = (Folder)setProfiledNodePathAndUrl((AbstractNode)((AbstractNode)folder).getParent(false));
                   }
   
                   // profile sibling folders by aggregating all siblings in profiled folders
  @@ -280,8 +282,8 @@
                   foldersIter = profiledFolders.iterator();
                   while (foldersIter.hasNext())
                   {
  -                    Folder aggregateFoldersFolder = (Folder) foldersIter.next();
  -                    NodeSet aggregateFolders = aggregateFoldersFolder.getFolders().exclusiveSubset("^.*/" + PROFILE_PROPERTY_FOLDER_PREFIX + "[^/]*$");
  +                    FolderImpl aggregateFoldersFolder = (FolderImpl) foldersIter.next();
  +                    NodeSet aggregateFolders = aggregateFoldersFolder.getFolders(false).exclusiveSubset("^.*/" + PROFILE_PROPERTY_FOLDER_PREFIX + "[^/]*$");
                       Iterator aggregateFoldersIter = aggregateFolders.iterator();
                       while (aggregateFoldersIter.hasNext())
                       {
  @@ -295,8 +297,8 @@
                   foldersIter = searchProfiledFolders.iterator();
                   while (foldersIter.hasNext())
                   {
  -                    Folder aggregateFolder = (Folder) foldersIter.next();
  -                    NodeSet aggregateFolderDocumentSets = aggregateFolder.getDocumentSets();
  +                    FolderImpl aggregateFolder = (FolderImpl) foldersIter.next();
  +                    NodeSet aggregateFolderDocumentSets = aggregateFolder.getDocumentSets(false);
                       Iterator aggregateFolderDocumentSetsIter = aggregateFolderDocumentSets.iterator();
                       while (aggregateFolderDocumentSetsIter.hasNext())
                       {
  @@ -363,10 +365,10 @@
                       foldersIter = profiledFolders.iterator();
                       while (foldersIter.hasNext())
                       {
  -                        Folder aggregateLinksFolder = (Folder) setProfiledNodePathAndUrl((AbstractNode) foldersIter.next());
  -                        if (((AbstractNode) aggregateLinksFolder).getProfiledPath().equals(Folder.PATH_SEPARATOR))
  +                        FolderImpl aggregateLinksFolder = (FolderImpl) setProfiledNodePathAndUrl((AbstractNode) foldersIter.next());
  +                        if (aggregateLinksFolder.getProfiledPath().equals(Folder.PATH_SEPARATOR))
                           {
  -                            NodeSet aggregateLinks = aggregateLinksFolder.getLinks();
  +                            NodeSet aggregateLinks = aggregateLinksFolder.getLinks(false);
                               Iterator aggregateLinksIter = aggregateLinks.iterator();
                               while (aggregateLinksIter.hasNext())
                               {
  @@ -408,13 +410,13 @@
                           folderPath = Folder.PATH_SEPARATOR;
                       }
                   }
  -                folder = getFolder(folderPath);
  +                folder = folderHandler.getFolder(folderPath);
                   String pagePath = requestPath;
                   if (! pagePath.endsWith(Page.DOCUMENT_TYPE))
                   {
                       pagePath = folder.getDefaultPage(true);
                   }
  -                page = folder.getPage(pagePath);
  +                page = ((FolderImpl)folder).getPage(pagePath, false);
               }
               catch (NodeException ne)
               {
  @@ -425,9 +427,9 @@
                   log.warn("computeProfiledPageContext(): Falling back to managed root default page for " + requestPath);
                   try
                   {
  -                    folder = getFolder(Folder.PATH_SEPARATOR);
  +                    folder = folderHandler.getFolder(Folder.PATH_SEPARATOR);
                       String pagePath = folder.getDefaultPage(true);
  -                    page = folder.getPage(pagePath);
  +                    page = ((FolderImpl)folder).getPage(pagePath, false);
                   }
                   catch (NodeException ne)
                   {
  @@ -438,13 +440,13 @@
               if (page != null)
               {
                   // return folders and pages relative to requested page
  -                siblingPages = folder.getPages();
  -                parentFolder = (Folder) folder.getParent();
  -                siblingFolders = folder.getFolders();
  +                siblingPages = ((FolderImpl)folder).getPages(false);
  +                parentFolder = (Folder) ((AbstractNode)folder).getParent(false);
  +                siblingFolders = ((FolderImpl)folder).getFolders(false);
                   try
                   {
  -                    Folder rootFolder = getFolder(Folder.PATH_SEPARATOR);
  -                    rootLinks = rootFolder.getLinks();
  +                    Folder rootFolder = folderHandler.getFolder(Folder.PATH_SEPARATOR);
  +                    rootLinks = ((FolderImpl)rootFolder).getLinks(false);
                   }
                   catch (NodeException ne)
                   {
  @@ -452,18 +454,18 @@
                   try
                   {
                       // get default document set order from folder
  -                    Comparator documentComparator = ((NodeSetImpl) folder.getAllNodes()).getComparator();
  +                    Comparator documentComparator = ((NodeSetImpl)((FolderImpl)folder).getAllNodes()).getComparator();
   
                       // aggregate and expand document sets from page to root folder;
                       documentSets = new NodeSetImpl(null, documentComparator);
                       documentSetNames = new HashMap(8);
                       documentSetNodeSets = new HashMap(8);
                       Set uniqueDocumentSetPaths = new HashSet(8);
  -                    Folder aggregateFolder = folder;
  +                    FolderImpl aggregateFolder = (FolderImpl)folder;
                       do
                       {
                           // aggregate uniquely named and expand folder document sets
  -                        Iterator documentSetsIter = aggregateFolder.getDocumentSets().iterator();
  +                        Iterator documentSetsIter = aggregateFolder.getDocumentSets(false).iterator();
                           while (documentSetsIter.hasNext())
                           {
                               DocumentSet documentSet = (DocumentSet) documentSetsIter.next();
  @@ -487,7 +489,7 @@
                           }
   
                           // aggregate document sets in parent
  -                        aggregateFolder = (Folder) aggregateFolder.getParent();
  +                        aggregateFolder = (FolderImpl) ((AbstractNode)aggregateFolder).getParent(false);
                       }
                       while (aggregateFolder != null);
                   }
  @@ -547,7 +549,7 @@
                   }
                   try
                   {
  -                    FolderImpl folder = (FolderImpl) setProfiledNodePathAndUrl((AbstractNode) getFolder(folderPath));
  +                    FolderImpl folder = (FolderImpl) setProfiledNodePathAndUrl((AbstractNode) folderHandler.getFolder(folderPath));
                       if ((folder.getMetaData() != null) && (folder.getMetaData().getDocumentOrder() != null) &&
                           ! folder.getMetaData().getDocumentOrder().isEmpty())
                       {
  @@ -602,7 +604,7 @@
                   // document set nodes
                   try
                   {
  -                    Iterator pathNodesIter = filterDocumentSet(getNodes(searchPath, regexp, null)).iterator();
  +                    Iterator pathNodesIter = filterDocumentSet(folderHandler.getNodes(searchPath, regexp, null)).iterator();
                       while (pathNodesIter.hasNext())
                       {
                           expandedNodes = addUniqueOrDescribedUrlNode(expandedNodes, setProfiledNodePathAndUrl((AbstractNode) pathNodesIter.next()));
  @@ -928,7 +930,7 @@
                           folderPath = Folder.PATH_SEPARATOR;
                       }
                   }
  -                searchFolder = getFolder(folderPath);
  +                searchFolder = folderHandler.getFolder(folderPath);
   
                   // match page if not previously matched
                   if (page[0] == null)
  @@ -974,7 +976,7 @@
                       // access matched page
                       if (pagePath != null)
                       {
  -                        searchPage = searchFolder.getPage(pagePath);
  +                        searchPage = ((FolderImpl)searchFolder).getPage(pagePath, false);
                       }
                   }
   
  @@ -1023,7 +1025,7 @@
                       do
                       {
                           searchFolders.add(searchFolder);
  -                        searchFolder = (Folder) searchFolder.getParent();
  +                        searchFolder = (Folder) ((AbstractNode)searchFolder).getParent(false);
                       }
                       while ((searchFolder != null) && ! searchFolder.getName().startsWith(PROFILE_PROPERTY_FOLDER_PREFIX));
                   }
  @@ -1051,7 +1053,7 @@
                               // get folder if it exists and folder name
                               try
                               {
  -                                searchFolder = getFolder(folderPath);
  +                                searchFolder = folderHandler.getFolder(folderPath);
                                   searchFolderName = searchFolder.getName();
                               }
                               catch (NodeException ne)
  @@ -1070,7 +1072,7 @@
                           else
                           {
                               // get folder as parent of search folder
  -                            searchFolder = (Folder) searchFolder.getParent();
  +                            searchFolder = (Folder) ((AbstractNode)searchFolder).getParent(false);
                               if (searchFolder != null)
                               {
                                   searchFolderName = searchFolder.getName();
  @@ -1104,7 +1106,7 @@
               Page lastSearchFolderFoundPage = null;
               try
               {
  -                lastSearchFolderFoundPage = lastSearchFolderFound.getPage(defaultPagePath);
  +                lastSearchFolderFoundPage = ((FolderImpl)lastSearchFolderFound).getPage(defaultPagePath, false);
               }
               catch (NodeException ne)
               {
  @@ -1306,7 +1308,7 @@
               // get filtered document/folder node or nodes and add to expanded set
               try
               {
  -                Iterator pathNodesIter = filterDocumentSet(getNodes(path, regexp, null)).iterator();
  +                Iterator pathNodesIter = filterDocumentSet(folderHandler.getNodes(path, regexp, null)).iterator();
                   while (pathNodesIter.hasNext())
                       expandedNodes.add((AbstractNode) pathNodesIter.next());
               }
  @@ -1381,27 +1383,32 @@
       }
   
       /**
  -     * 
        * <p>
        * getPage
        * </p>
        * 
        * @see org.apache.jetspeed.page.PageManager#getPage(java.lang.String)
        * @param path
  -     * @return @throws
  -     *         PageNotFoundException
  -     * @throws IllegalStateException
  -     *             if the page could be inserted into the FileCache.
  +     * @return page
  +     * @throws PageNotFoundException
  +     * @throws NodeException
  +     * @throws FolderNotFoundException
        */
  -    public Page getPage( String path ) throws PageNotFoundException, NodeException
  +    public Page getPage(String path) throws PageNotFoundException, FolderNotFoundException, NodeException
       {
  -        return (Page) addParent(handlerFactory.getDocumentHandler(Page.DOCUMENT_TYPE).getDocument(path), path);
  +        // get page via folder, (access checked in Folder.getPage())
  +        Folder folder = getNodeFolder(path);
  +        return folder.getPage(getNodeName(path));
       }
   
       /**
  +     * <p>
  +     * registerPage
  +     * </p>
  +     * 
        * @see org.apache.jetspeed.services.page.PageManagerService#registerPage(org.apache.jetspeed.om.page.Page)
        */
  -    public void registerPage( Page page ) throws JetspeedException
  +    public void registerPage(Page page) throws JetspeedException
       {
           // make sure path and related members are set
           if (page.getPath() == null)
  @@ -1416,26 +1423,42 @@
                   return;
               }
               setProfiledNodePathAndUrl((AbstractNode)page);
  -            addParent(page, page.getPath());
  +            Folder folder = getNodeFolder(page.getPath());
  +            page.setParent(folder);
           }
   
  +        // check for edit access
  +        page.checkAccess(SecuredResource.EDIT_ACTION);
  +
           // register page
           handlerFactory.getDocumentHandler(Page.DOCUMENT_TYPE).updateDocument(page);
       }
   
       /**
  +     * <p>
  +     * updatePage
  +     * </p>
  +     * 
        * @see org.apache.jetspeed.services.page.PageManagerService#updatePage(org.apache.jetspeed.om.page.Page)
        */
  -    public void updatePage( Page page ) throws JetspeedException
  +    public void updatePage(Page page) throws JetspeedException
       {
           registerPage(page);
       }
   
       /**
  +     * <p>
  +     * removePage
  +     * </p>
  +     * 
        * @see org.apache.jetspeed.services.page.PageManagerService#removePage(org.apache.jetspeed.om.page.Page)
        */
  -    public void removePage( Page page ) throws JetspeedException
  +    public void removePage(Page page) throws JetspeedException
       {
  +        // check for edit access
  +        page.checkAccess(SecuredResource.EDIT_ACTION);
  +
  +        // remove page
           handlerFactory.getDocumentHandler(Page.DOCUMENT_TYPE).removeDocument(page);
       }
   
  @@ -1446,17 +1469,17 @@
        * 
        * @see org.apache.jetspeed.page.PageManager#getLink(java.lang.String)
        * @param path
  -     * @return @throws
  -     *         DocumentNotFoundException
  +     * @return link
        * @throws DocumentNotFoundException
        * @throws UnsupportedDocumentTypeException
  -     * @throws 
        * @throws NodeException
        * @throws FolderNotFoundException
        */
  -    public Link getLink( String path ) throws DocumentNotFoundException, UnsupportedDocumentTypeException, FolderNotFoundException, NodeException
  +    public Link getLink(String path) throws DocumentNotFoundException, UnsupportedDocumentTypeException, FolderNotFoundException, NodeException
       {
  -        return (Link) addParent(handlerFactory.getDocumentHandler(Link.DOCUMENT_TYPE).getDocument(path), path);
  +        // get link via folder, (access checked in Folder.getLink())
  +        Folder folder = getNodeFolder(path);
  +        return folder.getLink(getNodeName(path));
       }
   
       /**
  @@ -1466,16 +1489,17 @@
        * 
        * @see org.apache.jetspeed.page.PageManager#getDocumentSet(java.lang.String)
        * @param path
  -     * @return @throws
  -     *         DocumentNotFoundException
  +     * @return document set
        * @throws DocumentNotFoundException
        * @throws UnsupportedDocumentTypeException
        * @throws NodeException
        * @throws FolderNotFoundException
        */
  -    public DocumentSet getDocumentSet( String path ) throws DocumentNotFoundException, UnsupportedDocumentTypeException, FolderNotFoundException, NodeException
  +    public DocumentSet getDocumentSet(String path) throws DocumentNotFoundException, UnsupportedDocumentTypeException, FolderNotFoundException, NodeException
       {
  -        return (DocumentSet) addParent(handlerFactory.getDocumentHandler(DocumentSet.DOCUMENT_TYPE).getDocument(path), path);
  +        // get document set via folder, (access checked in Folder.getDocumentSet())
  +        Folder folder = getNodeFolder(path);
  +        return folder.getDocumentSet(getNodeName(path));
       }
   
       /**
  @@ -1492,8 +1516,9 @@
        */
       public PageSecurity getPageSecurity() throws DocumentNotFoundException, UnsupportedDocumentTypeException, FolderNotFoundException, NodeException
       {
  -        String pageSecurityPath = Folder.PATH_SEPARATOR + PageSecurity.DOCUMENT_TYPE;
  -        return (PageSecurity) addParent(handlerFactory.getDocumentHandler(PageSecurity.DOCUMENT_TYPE).getDocument(pageSecurityPath), pageSecurityPath);
  +        // get page security via folder, (always allow access)
  +        Folder folder = getNodeFolder(Folder.PATH_SEPARATOR);
  +        return folder.getPageSecurity();
       }
   
       /**
  @@ -1510,48 +1535,31 @@
        * @throws InvalidFolderException
        * @throws IOException
        */
  -    public Folder getFolder( String folderPath ) throws FolderNotFoundException, InvalidFolderException, NodeException
  +    public Folder getFolder(String folderPath) throws FolderNotFoundException, InvalidFolderException, NodeException
       {
  +        // get folder, (always allow access to facilitate
  +        // navigation to potentially accessible pages)
           return folderHandler.getFolder(folderPath);
       }
   
  -    protected Node addParent( Node childNode, String nodePath ) throws NodeException, InvalidFolderException
  +    private Folder getNodeFolder(String nodePath) throws NodeException, InvalidFolderException
       {
  -        int lastSlash = nodePath.indexOf(Folder.PATH_SEPARATOR);
  -        if (lastSlash > -1)
  -        {
  -            childNode.setParent(folderHandler.getFolder(nodePath.substring(0, lastSlash)));
  -        }
  -        else
  +        int folderIndex = nodePath.lastIndexOf(Folder.PATH_SEPARATOR);
  +        if (folderIndex > 0)
           {
  -            childNode.setParent(folderHandler.getFolder(Folder.PATH_SEPARATOR));
  +            return folderHandler.getFolder(nodePath.substring(0, folderIndex));
           }
  -        return childNode;
  +        return folderHandler.getFolder(Folder.PATH_SEPARATOR);
       }
   
  -    /**
  -     * <p>
  -     * getNodes
  -     * </p>
  -     * <p>
  -     * Returns a set of nodes relative to the <code>folder</code> argument of the type
  -     * indicated by the <code>documentType</code> argument. The <code>folder</code> argument
  -     * may include regular expressions if indicated by the <code>regex</code> argument. The
  -     * returned set is unordered.
  -     * </p>
  -     *
  -     * @param path Path from which to locate documents
  -     * @param regex Flag indicating whether regex should be expanded in path
  -     * @param documentType document type to filter on.
  -     * @return NodeSet of documents and folders located under the <code>path</code> argument.
  -     * @throws FolderNotFoundException if folder under the <code>path</code> does not actually exist.
  -     * @throws DocumentException if an error is encountered reading the folders.
  -     * @throws InvalidFolderException
  -     * @throws NodeException
  -     */
  -    public NodeSet getNodes(String path, boolean regex, String documentType) throws FolderNotFoundException, InvalidFolderException, NodeException
  +    private String getNodeName(String nodePath)
       {
  -        return folderHandler.getNodes(path,regex,documentType);
  +        int folderIndex = nodePath.lastIndexOf(Folder.PATH_SEPARATOR);
  +        if (folderIndex > -1)
  +        {
  +            return nodePath.substring(folderIndex+1);
  +        }
  +        return nodePath;
       }
   
       /**
  
  
  
  1.9       +4 -50     jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/AbstractPageManager.java
  
  Index: AbstractPageManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/AbstractPageManager.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractPageManager.java	19 Nov 2004 03:06:44 -0000	1.8
  +++ AbstractPageManager.java	23 Nov 2004 00:01:32 -0000	1.9
  @@ -30,6 +30,7 @@
   import org.apache.jetspeed.om.page.Link;
   import org.apache.jetspeed.om.page.Page;
   import org.apache.jetspeed.om.page.Property;
  +import org.apache.jetspeed.om.page.psml.AbstractBaseElement;
   import org.apache.jetspeed.om.page.psml.FragmentImpl;
   import org.apache.jetspeed.om.page.psml.PageImpl;
   import org.apache.jetspeed.om.page.psml.PropertyImpl;
  @@ -324,7 +325,6 @@
               }
               catch (SecurityException se)
               {
  -                log.debug("checkAccess(): Access denied to folder or document " + node);
                   if (!throwException)
                   {
                       return null;
  @@ -337,56 +337,10 @@
   
       protected NodeSet checkAccess(NodeSet nodes, String actions)
       {
  -        if ((nodes != null) && (nodes.size() > 0))
  +        if (nodes != null)
           {
               // check permissions and constraints, filter nodes as required
  -            NodeSet filteredNodes = null;
  -            Iterator checkAccessIter = nodes.iterator();
  -            while (checkAccessIter.hasNext())
  -            {
  -                AbstractNode node = (AbstractNode)checkAccessIter.next();
  -                try
  -                {
  -                    // check access
  -                    checkAccess(node, actions, true);
  -
  -                    // add to filtered nodes if copying
  -                    if (filteredNodes != null)
  -                    {
  -                        // permitted, add to filtered nodes
  -                        filteredNodes.add(node);
  -                    }
  -                }
  -                catch (SecurityException se)
  -                {
  -                    // create filtered nodes if not already copying
  -                    if (filteredNodes == null)
  -                    {
  -                        // not permitted, copy previously permitted nodes
  -                        // to new filtered node set with same comparator
  -                        filteredNodes = new NodeSetImpl(null, ((NodeSetImpl)nodes).getComparator());;
  -                        Iterator copyIter = nodes.iterator();
  -                        while (copyIter.hasNext())
  -                        {
  -                            Node copyNode = (Node)copyIter.next();
  -                            if (copyNode != node)
  -                            {
  -                                filteredNodes.add(copyNode);
  -                            }
  -                            else
  -                            {
  -                                break;
  -                            }
  -                        }
  -                    }
  -                }
  -            }
  -
  -            // return filtered nodes if generated
  -            if (filteredNodes != null)
  -            {
  -                nodes = filteredNodes;
  -            }
  +            return AbstractBaseElement.checkAccess(nodes, actions);
           }
           return nodes;
       }
  
  
  
  1.8       +56 -10    jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/om/folder/Folder.java
  
  Index: Folder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/om/folder/Folder.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Folder.java	19 Oct 2004 04:43:18 -0000	1.7
  +++ Folder.java	23 Nov 2004 00:01:32 -0000	1.8
  @@ -16,9 +16,14 @@
   package org.apache.jetspeed.om.folder;
   
   
  +import org.apache.jetspeed.om.folder.DocumentSet;
  +import org.apache.jetspeed.om.folder.Folder;
  +import org.apache.jetspeed.om.page.Link;
   import org.apache.jetspeed.om.page.Page;
  +import org.apache.jetspeed.om.page.PageSecurity;
   import org.apache.jetspeed.page.PageNotFoundException;
   import org.apache.jetspeed.page.document.DocumentException;
  +import org.apache.jetspeed.page.document.DocumentNotFoundException;
   import org.apache.jetspeed.page.document.Node;
   import org.apache.jetspeed.page.document.NodeException;
   import org.apache.jetspeed.page.document.NodeSet;
  @@ -91,6 +96,19 @@
       /**
        * 
        * <p>
  +     * getFolder
  +     * </p>
  +     *
  +     * @param name
  +     * @return A Folder referenced by this folder.
  +     * @throws FolderNotFoundException
  +     * @throws DocumentException
  +     */
  +    Folder getFolder(String name) throws FolderNotFoundException, DocumentException;
  +
  +    /**
  +     * 
  +     * <p>
        * getPages
        * </p>
        *
  @@ -108,7 +126,8 @@
        * </p>
        *
        * @param name
  -.     * @throws PageNotFoundException if the Page requested could not be found.
  +     * @return A Page referenced by this folder.
  +     * @throws PageNotFoundException if the Page requested could not be found.
        * @throws DocumentException
        * @throws NodeException
        */
  @@ -120,7 +139,7 @@
        * getLinks
        * </p>
        *
  -     * @return
  +     * @return NodeSet of all the Links referenced by this Folder.
        * @throws DocumentException
        * @throws NodeException
        */    
  @@ -129,10 +148,23 @@
       /**
        * 
        * <p>
  +     * getLink
  +     * </p>
  +     *
  +     * @param name
  +     * @return A Link referenced by this folder.
  +     * @throws DocumentNotFoundException if the document requested could not be found.
  +     * @throws NodeException
  +     */    
  +    Link getLink(String name) throws DocumentNotFoundException, NodeException;
  +    
  +    /**
  +     * 
  +     * <p>
        * getDocumentSets
        * </p>
        *
  -     * @return
  +     * @return NodeSet of all the Document Sets referenced by this Folder.
        * @throws DocumentException
        * @throws NodeException
        */    
  @@ -141,12 +173,26 @@
       /**
        * 
        * <p>
  -     * getAllNodes
  +     * getDocumentSet
        * </p>
        *
  -     * @return All Nodes immediatley under this Folder.
  -     * @throws DocumentException
  -     * @throws FolderNotFoundException
  -     */
  -    NodeSet getAllNodes() throws FolderNotFoundException, DocumentException;
  +     * @param name
  +     * @return A DocumentSet referenced by this folder.
  +     * @throws DocumentNotFoundException if the document requested could not be found.
  +     * @throws NodeException
  +     */    
  +    DocumentSet getDocumentSet(String name) throws DocumentNotFoundException, NodeException;
  +    
  +    /**
  +     * 
  +     * <p>
  +     * getPageSecurity
  +     * </p>
  +     *
  +     * @param name
  +     * @return A PageSecurity referenced by this folder.
  +     * @throws DocumentNotFoundException if the document requested could not be found.
  +     * @throws NodeException
  +     */    
  +    PageSecurity getPageSecurity() throws DocumentNotFoundException, NodeException;
   }
  
  
  

---------------------------------------------------------------------
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