Hi Bruce

Hmm, I'd expect this to work with WebDAV as admin. Creating nodes via
the API and then accessing them via WebDAV is expected, so that should
not cause any issues (provided you use nodetypes that are or inherit
from nt:folder and nt:file).

I believe the fact you see the mounted folder owned by 'bruce' should
not concern you. May it be due to the fact that you used user 'bruce'
to connect?

Sorry, I cannot currently see why it doesn't work for you. I'd
probably continue investigating by taking any locking and versioning
code out of the equation. Also, let us know the URL you use to connect
to WebDAV (at least in the CQ product, there are multiple WebDAV
servlets).

Regards
Julian


On Wed, Nov 26, 2014 at 8:00 AM, Bruce Edge
<bruce.e...@nextissuemedia.com> wrote:
> 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 <jsedd...@gmail.com<mailto:jsedd...@gmail.com>>
> Reply-To: "users@sling.apache.org<mailto:users@sling.apache.org>" 
> <users@sling.apache.org<mailto:users@sling.apache.org>>
> Date: Tuesday, November 25, 2014 at 10:42 PM
> To: "users@sling.apache.org<mailto:users@sling.apache.org>" 
> <users@sling.apache.org<mailto:users@sling.apache.org>>
> 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 
> <bruce.e...@nextissuemedia.com<mailto:bruce.e...@nextissuemedia.com>>
> 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