|
@@ -48,6 +48,7 @@ from radicale.app.propfind import ApplicationPartPropfind
|
|
|
from radicale.app.proppatch import ApplicationPartProppatch
|
|
from radicale.app.proppatch import ApplicationPartProppatch
|
|
|
from radicale.app.put import ApplicationPartPut
|
|
from radicale.app.put import ApplicationPartPut
|
|
|
from radicale.app.report import ApplicationPartReport
|
|
from radicale.app.report import ApplicationPartReport
|
|
|
|
|
+from radicale.item import check_and_sanitize_props
|
|
|
from radicale.log import logger
|
|
from radicale.log import logger
|
|
|
|
|
|
|
|
# Combination of types.WSGIStartResponse and WSGI application return value
|
|
# Combination of types.WSGIStartResponse and WSGI application return value
|
|
@@ -268,7 +269,15 @@ class Application(ApplicationPartDelete, ApplicationPartHead,
|
|
|
if "W" in self._rights.authorization(user, principal_path):
|
|
if "W" in self._rights.authorization(user, principal_path):
|
|
|
with self._storage.acquire_lock("w", user):
|
|
with self._storage.acquire_lock("w", user):
|
|
|
try:
|
|
try:
|
|
|
- self._storage.create_collection(principal_path)
|
|
|
|
|
|
|
+ new_coll = self._storage.create_collection(principal_path)
|
|
|
|
|
+ if new_coll:
|
|
|
|
|
+ jsn_coll = self.configuration.get("storage", "predefined_collections")
|
|
|
|
|
+ for (name_coll, props) in jsn_coll.items():
|
|
|
|
|
+ try:
|
|
|
|
|
+ checked_props = check_and_sanitize_props(props)
|
|
|
|
|
+ self._storage.create_collection(principal_path + name_coll, props=checked_props)
|
|
|
|
|
+ except ValueError as e:
|
|
|
|
|
+ logger.warning("Failed to create predefined collection %r: %s", name_coll, e)
|
|
|
except ValueError as e:
|
|
except ValueError as e:
|
|
|
logger.warning("Failed to create principal "
|
|
logger.warning("Failed to create principal "
|
|
|
"collection %r: %s", user, e)
|
|
"collection %r: %s", user, e)
|