Hello Juliette,

you could try to accomplish this task by using org.jahia.services.webdav.DAVFileAccess API

Here is a short example, that iterates through resources of the '/users/smith/public' folder:

// get e.g. the '/users/smith/public' folder
DAVFileAccess dfa = JahiaWebdavBaseService.getInstance().getDAVFileAccess(jParams, "/users/smith/public");

// is it a folder, that has any children?
if (dfa.isCollection() && dfa.getChildren().size() > 0)
{
        // get the child resources
        List childResources = dfa.getChildren();
       
        //iterate over all children and e.g. check the read access
        for (Iterator iter = childResources.iterator(); iter.hasNext();)
        {
                DAVFileAccess curDfa = (DAVFileAccess) iter.next();
                if(curDfa.hasPermission(DAVFileAccess.READ))
                {
                        //get the name and the path
                        String name = curDfa.getName(); // myImage.gif
                        String path = curDfa.getPath(); // /users/smith/public/myImage.gif
                }
        }
}


Kind regards.
Sergiy.



"Juliette Mainka" <[EMAIL PROTECTED]>

08.02.2006 11:23

Please respond to
<[email protected]>

To
<[email protected]>
cc
Subject
How to access WEBDAV content from within a template?





Hello,

In a template, I want to list the content of a given WEBDAV directory. I
tried to access the directory via the Apache Slide/Webdav API (class
WebdavResource), but to use this, I need to have the current user's
password. Is there a way to retrieve this password?

Or is there perhaps another way to access Webdav content? For example, in
the file chooser popup window/engine, I noticed that the user can see and
use files according to his permissions on them, without having to enter his
password again. Does anyone know how this is done, and if this can also be
used from within a template?

Thanks in advance.

Regards,
Juliette


Reply via email to