1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-09-15 20:36:55 +00:00

Merge pull request #1473 from itglob/master

Ability to create predefined calendar or(and) addressbook for new user
This commit is contained in:
Peter Bieringer 2024-06-11 22:18:25 +02:00 committed by GitHub
commit e9c7d4a671
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 63 additions and 2 deletions

View file

@ -274,7 +274,14 @@ class Application(ApplicationPartDelete, ApplicationPartHead,
if "W" in self._rights.authorization(user, principal_path):
with self._storage.acquire_lock("w", user):
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:
self._storage.create_collection(principal_path + name_coll, props=props)
except ValueError as e:
logger.warning("Failed to create predefined collection %r: %s", name_coll, e)
except ValueError as e:
logger.warning("Failed to create principal "
"collection %r: %s", user, e)