nextcloud / files_lock

GNU Affero General Public License v3.0
24 stars 8 forks source link

Honor LOCK and UNLOCK from WebDAV requests #44

Closed solracsf closed 2 years ago

solracsf commented 2 years ago

Would be a great option if LOCK and UNLOCK methods from WebDAV would be honored by the app so WebDAV could be more "user friendly" for files opened and closed, as WebDAV clients send those methods but they are not understood/honored by the server.

To be clear:

juliushaertl commented 2 years ago

I had a look into implementing LOCK/UNLOCK support through webdav, however it seems that the current approach of locking per user and basically allowing the user owning the lock is conflicting with the approach that webdav uses where a lock is identified by a token which then needs to be sent with the actual file operation through the If header which is currently not done by the web UI. https://docs.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2003/aa142897(v=exchg.65)#using-the-if-header-with-a-lock-token

Some code pointers on the sabre parts: https://github.com/sabre-io/dav/blob/75e3e888a469eb39773ff1389c2666b48df73dca/lib/DAV/Server.php#L1429-L1448 https://github.com/sabre-io/dav/blob/master/lib/DAV/Locks/Plugin.php

juliushaertl commented 2 years ago

First steps to prepare for this made in #54 the missing parts would be to implement the BackendInterface methods to properly handle WebDAV lock especially with their differentiation of shared/exclusive locking and proper handling of the token matching within the storage wrapper abstraction. The token is matched already in the If header by Sabre.

solracsf commented 2 years ago

@juliushaertl may I ask if this will also handle calls from the desktop clients as well (as they speak WebDAV)? If yes, this could be a very recommended app to install alongside client deployments.