Hi Julian,

The WebDAV mount is authenticated using the default admin account. I know it's 
probably not a best practice to create nodes using JcrUtils, then jump over to 
WebDAV to unpack a zip in the new nt:folder node, but this needs to work with 
older code that expects a filesystem target directory.
I would have expected the admin account to have appropriate write permissions.

I find the fact that the new nodes are created using my local user's ownership 
very odd as the server is running as a sling UID:
%> ps au | grep sling
sling     7028 19.6  7.0 3832456 287164 pts/4  Sl   22:52   1:10 /usr/bin/java 
-Xmx384M -agentlib:jdwp=transport=dt_socket,address=30303,server=y,suspend=n 
-jar /opt/sling/sling/org.apache.sling.launchpad-8-SNAPSHOT-standalone.jar -c 
/var/lib/sling -p 8090 -a 0.0.0.0

-Bruce

From: Julian Sedding <[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Date: Tuesday, November 25, 2014 at 10:42 PM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: Re: Make a JcrUtils created node writable from WebDAV?

Hi Bruce

You could try authenticating your WebDAV connection with the admin
credentials. If that works, it's likely to be an issue with the setup of
your JCR permissions. You may well be connecting as anonymous currently and
therefore be denied writes (I'm not familiar with the vanilla Sling
permission setup).

Regards
Julian


On Wednesday, November 26, 2014, Bruce Edge 
<[email protected]<mailto:[email protected]>>
wrote:

Apologies for asking something that seems like it should be so simple.
What else do I need to make a node that I create using
JcrUtils.getOrCreateByPath(..) be writable from WebDAV?

adminResolver = resolverFactory.getAdministrativeResourceResolver(null);
adminSession = adminResolver.adaptTo(Session.class);
Node destinationNode = JcrUtils.getOrCreateByPath(destination,
JcrConstants.NT_FOLDER, adminSession);
destinationNode.addMixin(JcrConstants.MIX_LOCKABLE);
destinationNode.addMixin(JcrConstants.MIX_VERSIONABLE);
adminSession.save();
Lock lock = lockManager.lock(destination, true, true, Long.MAX_VALUE,
NimJcrConstants.INGEST_JOB_TOPIC);

VersionManager versionManager = workspace.getVersionManager();

versionManager.checkout(destination);

I'm calling a legacy library that expects a writable destination folder.
I'm passing the WebDAV folder name and failing with:

java.io.FileNotFoundException: /mnt/jcr/test/test.txt (Permission denied)

The file system view shows the folder is owned by my UID rather than the
UID of the sling daemon:
%> ls -ld /mnt/jcr/test
drwx------ 1 bedge staff 2048 Nov 25 16:05 /mnt/jcr/test

Can I set the file system permissions using javax.jcr?

-Bruce


Reply via email to