amartel / redmine_webdav

WebDav plugin for redmine
Other
35 stars 8 forks source link

Missing write permission in documents subfolders for users with "Manage Redmine" permissions #16

Closed Sethur closed 11 years ago

Sethur commented 11 years ago

Hi,

I just managed to get the webdav plugin running, but now I am getting a 404 error whenever I try to put a file into a documents subdirectory, although the user has the permissions set correctly (e.g. "Use Webdav" and "Manage Webdav"). I tried it from linux (with cadaver) and Windows 7 (using the internal webdav client). Connection works fine, authentication, too, and I can see all the files I put on using the web interface. Also, I can create subdirectories inside the "documents" folder and delete them again (+ they show up in Redmine), but I cannot do the same thing in the files folder.

As said above, when I try to copy files into the subdirectories, cadaver gives me a 404 error, while Windows 7 claims "Can't read from the source file or disc".

I have activated MaxOSX writing with no success. I would really like to get this working, so any hints would be much appreciated.

Cheers,

Tristan

amartel commented 11 years ago

OK and I can reproduce the problem. I suspect that there is something wrong with attachments but I can't fix it right now (I'm currently out of office). I will commit a corrected version tomorrow morning (sorry).

kind regards, Arnaud

Sethur commented 11 years ago

Thank you kindly, really looking forward to get this to a working state finally. I am using Redmine 2.1.2, by the way.

amartel commented 11 years ago

Done and committed. I have tested files, files+version, documents and everything seems to be OK now....

Sethur commented 11 years ago

Thank you for your work.

Now everything works fine under linux with Cadaver, still having random errors with Windows 7, though. Copying files worked for a short time with the documents-subfolders but never with files. Also, I do get empty files when I try to put something in the files subfolder.

The error messages I get in Windows are strange, it does not complain about missing file permissions, but rather says "This is no longer located in Z:\mrl. Verify the items location and try again" when I try to copy some file to "Z:\mrl\files", where Z: is my mapped webdav folder.

I should also mention (and I think this might be connected), that in Windows 7 (I am using x64) the contents of the mapped Webdav folder are disappearing and reappearing randomly when refreshing (i.e. hitting F5). Mostly, when I connect to the webdav-resource, they are not shown in the beginning, but appear after an initial refresh.

Any ideas on this?

amartel commented 11 years ago

Strange. I know that Windows 7 has some issues with webdav but I really have not problem to copy a file from my local disk to the webdav folder and I'm using 7 x64 too for this test... I have some users who were complaining about webdav access with windows 7. We spent a lot of time to try to find a workaround and, finally, they are now using CarotDAV to manage their files over webdav (and they have no more troubles..)

Maybe you can open your $REDMINE_HOME/log/production.log to see if there are some useful information...

Sethur commented 11 years ago

Just had a look at production.log, nothing useful in there. One reason for my troubles might be, that I am using a SSL encryption for the Redmine server with a self-signed certificate, that I imported into Windows 7 (otherwise webdav is not working at all).

With this setup, I previously was successfully able to connect to a Apache supplied Webdav folder (with writing permissions) so that should theoretically not be a problem. I know that Windows is evil when it comes to proper Webdav support but it would be really nice to get this working without the need of any additional software. Do you have any more ideas of what I could try?

Edit: I just tried my luck with CarotDAV, which gave some interesting results: With CarrotDAV, deleting files seems to work, but they reappear on refresh. Also, whenever I change directory, I get this error message, but it works if I retry. Copying files does not work as well, I get the same PROPFIND error.

Rei.Fs.SimpleWebException: Unassumed PROPFIND response
Status: 200
   at Rei.Fs.Webdav.WebdavFs.InnerGetInfo(Uri target, DepthType depth)
   at Rei.Fs.Webdav.WebdavFs.GetInfoAndEntries(ResourceId id)
   at CarotDAV.CacheManager.GetInfoAndEntries(FsBase fs, ResourceId id, Boolean enablecache)
   at CarotDAV.MainForm.Fs_GetInfoAndInnerEntries(Uri uri, ResourceId id, ResourceId parentid, Boolean enablecache)

May this have something todo with above problems? I meanwhile tried deactivating my LDAP authentication (I deleted it completely from Redmine) just to make sure this has nothing to do with it. Unfortunately, this didn't help either.

Sethur commented 11 years ago

For further debugging, here the PROPFIND response on one of my project directories (I have no idea if this is supposed to look like this):

curl  -k -X PROPFIND -u "tnowak:xxxxx" https://myserver/webdav/mrl

<?xml version="1.0" encoding="UTF-8"?> <D:multistatus xmlns:D="DAV:"><D:response><D:href>/webdav/mrl/</D:href><D:propstat><D:prop><D:creationdate>2012-08-01T02:00:00Z</D:creationdate><D:getetag>a-0-508809bd</D:getetag><D:getcontenttype>httpd/unix-directory</D:getcontenttype><D:getlastmodified>Wed, 24 Oct 2012 15:31:09 GMT</D:getlastmodified><D:getcontentlength></D:getcontentlength><D:displayname>MRI-Linac</D:displayname><D:resourcetype><D:collection/></D:resourcetype></D:prop><D:status>HTTP/1.1 200 OK</D:status></D:propstat></D:response><D:response><D:href>/webdav/mrl/files/</D:href><D:propstat><D:prop><D:creationdate>2012-08-01T02:00:00Z</D:creationdate><D:getetag>69-0-508809bd</D:getetag><D:getcontenttype>httpd/unix-directory</D:getcontenttype><D:getlastmodified>Wed, 24 Oct 2012 15:31:09 GMT</D:getlastmodified><D:getcontentlength></D:getcontentlength><D:displayname>files</D:displayname><D:resourcetype><D:collection/></D:resourcetype></D:prop><D:status>HTTP/1.1 200 OK</D:status></D:propstat></D:response><D:response><D:href>/webdav/mrl/documents/</D:href><D:propstat><D:prop><D:creationdate>2012-08-01T02:00:00Z</D:creationdate><D:getetag>6d-0-508809bd</D:getetag><D:getcontenttype>httpd/unix-directory</D:getcontenttype><D:getlastmodified>Wed, 24 Oct 2012 15:31:09 GMT</D:getlastmodified><D:getcontentlength></D:getcontentlength><D:displayname>documents</D:displayname><D:resourcetype><D:collection/></D:resourcetype></D:prop><D:status>HTTP/1.1 200 OK</D:status></D:propstat></D:response></D:multistatus>
Sethur commented 11 years ago

Hi Arnaud,

after hours of debugging I finally found the problem and - surprise surprise - it was on my side, so no need to patch anything. The issue was that I had some zombie/ghost entries in the "files" folder, i.e. those were in the Redmine DB, but not present as actual files in one of my webdav-enabled projects. This was apparently enough to totally confuse the code in a way that made it work in Linux and randomly (not) in Windows. Now everything works, even the native windows client.

Thanks so much for your support and you very useful plugin.

Cheers,

Tristan