1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-08-13 18:50:53 +00:00

add for write requests "path" where missing and "request"

This commit is contained in:
Peter Bieringer 2025-08-12 16:11:24 +02:00
parent 0c16f86bd4
commit 19def4d561
6 changed files with 6 additions and 6 deletions

View file

@ -60,7 +60,7 @@ class ApplicationPartDelete(ApplicationBase):
access = Access(self._rights, user, path) access = Access(self._rights, user, path)
if not access.check("w"): if not access.check("w"):
return httputils.NOT_ALLOWED return httputils.NOT_ALLOWED
with self._storage.acquire_lock("w", user): with self._storage.acquire_lock("w", user, path=path, request="DELETE"):
item = next(iter(self._storage.discover(path)), None) item = next(iter(self._storage.discover(path)), None)
if not item: if not item:
return httputils.NOT_FOUND return httputils.NOT_FOUND

View file

@ -57,7 +57,7 @@ class ApplicationPartMkcalendar(ApplicationBase):
return httputils.BAD_REQUEST return httputils.BAD_REQUEST
# TODO: use this? # TODO: use this?
# timezone = props.get("C:calendar-timezone") # timezone = props.get("C:calendar-timezone")
with self._storage.acquire_lock("w", user): with self._storage.acquire_lock("w", user, path=path, request="MKCALENDAR"):
item = next(iter(self._storage.discover(path)), None) item = next(iter(self._storage.discover(path)), None)
if item: if item:
return self._webdav_error_response( return self._webdav_error_response(

View file

@ -62,7 +62,7 @@ class ApplicationPartMkcol(ApplicationBase):
if not props.get("tag") and "W" not in permissions: if not props.get("tag") and "W" not in permissions:
logger.warning("MKCOL request %r (type:%s): %s", path, collection_type, "rejected because of missing rights 'W'") logger.warning("MKCOL request %r (type:%s): %s", path, collection_type, "rejected because of missing rights 'W'")
return httputils.NOT_ALLOWED return httputils.NOT_ALLOWED
with self._storage.acquire_lock("w", user): with self._storage.acquire_lock("w", user, path=path, request="MKCOL"):
item = next(iter(self._storage.discover(path)), None) item = next(iter(self._storage.discover(path)), None)
if item: if item:
return httputils.METHOD_NOT_ALLOWED return httputils.METHOD_NOT_ALLOWED

View file

@ -73,7 +73,7 @@ class ApplicationPartMove(ApplicationBase):
if not to_access.check("w"): if not to_access.check("w"):
return httputils.NOT_ALLOWED return httputils.NOT_ALLOWED
with self._storage.acquire_lock("w", user): with self._storage.acquire_lock("w", user, path=path, request="MOVE", to_path=to_path):
item = next(iter(self._storage.discover(path)), None) item = next(iter(self._storage.discover(path)), None)
if not item: if not item:
return httputils.NOT_FOUND return httputils.NOT_FOUND

View file

@ -87,7 +87,7 @@ class ApplicationPartProppatch(ApplicationBase):
except socket.timeout: except socket.timeout:
logger.debug("Client timed out", exc_info=True) logger.debug("Client timed out", exc_info=True)
return httputils.REQUEST_TIMEOUT return httputils.REQUEST_TIMEOUT
with self._storage.acquire_lock("w", user): with self._storage.acquire_lock("w", user, path=path, request="PROPPATCH"):
item = next(iter(self._storage.discover(path)), None) item = next(iter(self._storage.discover(path)), None)
if not item: if not item:
return httputils.NOT_FOUND return httputils.NOT_FOUND

View file

@ -174,7 +174,7 @@ class ApplicationPartPut(ApplicationBase):
bool(rights.intersect(access.permissions, "Ww")), bool(rights.intersect(access.permissions, "Ww")),
bool(rights.intersect(access.parent_permissions, "w"))) bool(rights.intersect(access.parent_permissions, "w")))
with self._storage.acquire_lock("w", user, path=path): with self._storage.acquire_lock("w", user, path=path, request="PUT"):
item = next(iter(self._storage.discover(path)), None) item = next(iter(self._storage.discover(path)), None)
parent_item = next(iter( parent_item = next(iter(
self._storage.discover(access.parent_path)), None) self._storage.discover(access.parent_path)), None)