Hello,
I need to fill private webdav directories with private files (only accessible with authentification)
 
So i'm trying to register a file into a protected jahia webdav directory from a template.
The code below works perfectly if i try to write into a public directory (access granted to "guest").
 
But when I try to put a file into a private directory ("/shared/test/", with access restricted to the user "admin", the user "guest" can not even read the directory), i have the error in the console log :
 
4992360 [http-8080-Processor3]  WARN - Access denied on /shared/test by user /users/guest for action /actions/read
 
When i call the jahia page executing the template,  i'm connected as "admin" (the super-administrator of the site), and in the template code, the webdav authentification is set also to "admin", so I don't understand why the message still reference the user "/user/guest" ?
Is there particular jahia user / class to authentificate ?
Is there a jahia webdavRessource object in the session to use ?
 
(Connected as "admin" from the Microsoft Explorer, i can create files into that protected directory.)
jahia distribution : jahia405_build6016 (win XP)
The webdav libraries are those distributed within jahia (slide 1.x).
 
Here's the template code :
 
// **********************************************************
String webdavUrl =
            "
http://localhost:8080/jahia/webdav/site/myjahiasite/shared/test/";
String user="admin";
String pass="*******";
String localFilePath = "D:\\dev\\";
String fileName = "ii_rapp2_Sow.pdf";
String message ="OK";
 
try {
 
  HttpURL hrl = new HttpURL(webdavUrl);
  hrl.setUserInfo(user,pass);
 
  WebdavResource wdr =  new WebdavResource(hrl);
  java.io.File fn = new java.io.File(localFilePath + fileName);
  String davPath = wdr.getPath()  + fileName ;
 
  boolean success = wdr.putMethod(davPath,fn) ;
 
  if (success==false) message = "Erreur Webdav - " + wdr.getStatusMessage() ;
  wdr.close();
 
} catch(Exception e) {
  message = e.getMessage();
}

out.println(message);
// *************************************************
%>
 
 
 
...and here's the access rights of the directory "/shared/test/
 
Directory listing for /shared/test
Up To /shared
ACL Info
Subject Action Inheritable Deny
user /actions/read true true
user /actions/write true true
user /actions/manage true true
/users/dgs /actions/write true false
/users/dgs /actions/read true false
/users/dgs /actions/manage true false
root /actions/write true false
root /actions/read true false
root /actions/manage true false
nobody /actions/write true true
nobody /actions/read true true
nobody /actions/manage true true
 
Filename Size Last Modified
   sqdfsdfsf.rtf 4.5 kb Fri, 18 Aug 2006 13:47:59 GMT
 
Jakarta Slide 1.0 lun., 21 août 2006 18:18:40 CEST
 
 
thank you for any help !
seb

Reply via email to