1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-06-26 16:45:52 +00:00

improve/extend mkcol logging

This commit is contained in:
Peter Bieringer 2024-03-16 18:04:19 +01:00
parent 9a2d42afab
commit be53538738

View file

@ -52,8 +52,12 @@ class ApplicationPartMkcol(ApplicationBase):
logger.warning( logger.warning(
"Bad MKCOL request on %r: %s", path, e, exc_info=True) "Bad MKCOL request on %r: %s", path, e, exc_info=True)
return httputils.BAD_REQUEST return httputils.BAD_REQUEST
if (props.get("tag") and "w" not in permissions or collection_type = props.get("tag") or "UNKNOWN"
not props.get("tag") and "W" not in permissions): if 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'")
return httputils.NOT_ALLOWED
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'")
return httputils.NOT_ALLOWED return httputils.NOT_ALLOWED
with self._storage.acquire_lock("w", user): with self._storage.acquire_lock("w", user):
item = next(iter(self._storage.discover(path)), None) item = next(iter(self._storage.discover(path)), None)
@ -71,6 +75,7 @@ class ApplicationPartMkcol(ApplicationBase):
self._storage.create_collection(path, props=props) self._storage.create_collection(path, props=props)
except ValueError as e: except ValueError as e:
logger.warning( logger.warning(
"Bad MKCOL request on %r: %s", path, e, exc_info=True) "Bad MKCOL request on %r (type:%s): %s", path, collection_type, e, exc_info=True)
return httputils.BAD_REQUEST return httputils.BAD_REQUEST
logger.info("MKCOL request %r (type:%s): %s", path, collection_type, "successful")
return client.CREATED, {}, None return client.CREATED, {}, None