From b88bac0523cebb92c5c78fcda452e767aa891527 Mon Sep 17 00:00:00 2001 From: Nils Brederlow <62596379+dingodoppelt@users.noreply.github.com> Date: Tue, 7 Apr 2026 12:25:33 +0200 Subject: [PATCH 1/5] Trigger storage hook on sharing/delete with files backend Unlike with the csv backend the files backend acquired only a reading lock which didn't trigger the storage hook. --- radicale/sharing/files.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radicale/sharing/files.py b/radicale/sharing/files.py index 13ca15a6..6c9a87a5 100644 --- a/radicale/sharing/files.py +++ b/radicale/sharing/files.py @@ -372,8 +372,8 @@ class Sharing(sharing.BaseSharing): if not os.path.isfile(sharing_config_file): return {"status": "not-found"} - # read content - with self._storage.acquire_lock("r", path=sharing_config_file): + # open writable so storage hook triggers + with self._storage.acquire_lock("w", path=sharing_config_file): # read file with open(sharing_config_file, "rb") as fb: (version, row) = pickle.load(fb) From e85e87e4230af2f89d762f8930e0925a0e92b784 Mon Sep 17 00:00:00 2001 From: Nils Brederlow <62596379+dingodoppelt@users.noreply.github.com> Date: Tue, 7 Apr 2026 13:14:46 +0200 Subject: [PATCH 2/5] Pass user to sharing/delete API endpoint In the recommended storage hook for git integration no user gets passed when deleting a shared collection. The user is "Anonymus". This passes the owner name to the storage hook. --- radicale/sharing/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/radicale/sharing/__init__.py b/radicale/sharing/__init__.py index 43d4da94..7685b334 100644 --- a/radicale/sharing/__init__.py +++ b/radicale/sharing/__init__.py @@ -1223,7 +1223,8 @@ class BaseSharing: if user == share['Owner']: result = self.database_delete_sharing( ShareType=ShareType, - PathOrToken=PathOrToken) # verification above that it is not None + PathOrToken=PathOrToken, + User=share['Owner']) # verification above that it is not None else: # only owner is permitted to delete a share logger.warning(api_info + ": %r not permitted for user %r", PathOrToken, user) From 409a1af918368973e73ebe7fc4e214c36b0aa02d Mon Sep 17 00:00:00 2001 From: Nils Brederlow <62596379+dingodoppelt@users.noreply.github.com> Date: Tue, 7 Apr 2026 13:16:39 +0200 Subject: [PATCH 3/5] Add User parameter to database_delete_sharing method ...so the storage hook knows who deleted the share --- radicale/sharing/files.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/radicale/sharing/files.py b/radicale/sharing/files.py index 6c9a87a5..06b999d1 100644 --- a/radicale/sharing/files.py +++ b/radicale/sharing/files.py @@ -362,7 +362,8 @@ class Sharing(sharing.BaseSharing): def database_delete_sharing(self, ShareType: str, - PathOrToken: str) -> dict: + PathOrToken: str, + User: str) -> dict: """ delete sharing """ if logger.isEnabledFor(logging.DEBUG): logger.debug("TRACE/sharing/%s/delete: PathOrToken=%r", ShareType, PathOrToken) @@ -373,7 +374,7 @@ class Sharing(sharing.BaseSharing): return {"status": "not-found"} # open writable so storage hook triggers - with self._storage.acquire_lock("w", path=sharing_config_file): + with self._storage.acquire_lock("w", User, path=sharing_config_file): # read file with open(sharing_config_file, "rb") as fb: (version, row) = pickle.load(fb) From 658cfef7ed42642764b80505fb40401183d9992e Mon Sep 17 00:00:00 2001 From: Nils Brederlow <62596379+dingodoppelt@users.noreply.github.com> Date: Tue, 7 Apr 2026 13:22:40 +0200 Subject: [PATCH 4/5] Add User parameter to database_delete_sharing method In line with the changes made to files.py. Passes the user name as an additional argument so a storage hook can know who deleted a share --- radicale/sharing/csv.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/radicale/sharing/csv.py b/radicale/sharing/csv.py index 3c3d3c18..ccfd448c 100644 --- a/radicale/sharing/csv.py +++ b/radicale/sharing/csv.py @@ -371,12 +371,13 @@ class Sharing(sharing.BaseSharing): def database_delete_sharing(self, ShareType: str, - PathOrToken: str) -> dict: + PathOrToken: str, + User: str) -> dict: """ delete sharing """ if logger.isEnabledFor(logging.DEBUG): logger.debug("TRACE/sharing/%s/delete: PathOrToken=%r", ShareType, PathOrToken) - with self._storage.acquire_lock("w", path=self._sharing_db_file): + with self._storage.acquire_lock("w", User, path=self._sharing_db_file): # lookup token found = False index = 0 From 1ade6d96fb246e2e784a3e43a17591087b669d52 Mon Sep 17 00:00:00 2001 From: Nils Brederlow <62596379+dingodoppelt@users.noreply.github.com> Date: Tue, 7 Apr 2026 13:33:19 +0200 Subject: [PATCH 5/5] Add User parameter to database_delete_sharing method --- radicale/sharing/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/radicale/sharing/__init__.py b/radicale/sharing/__init__.py index 7685b334..9c0bf99e 100644 --- a/radicale/sharing/__init__.py +++ b/radicale/sharing/__init__.py @@ -281,7 +281,8 @@ class BaseSharing: def database_delete_sharing(self, ShareType: str, - PathOrToken: str) -> dict: + PathOrToken: str, + User: str) -> dict: """ delete sharing """ return {"status": "not-implemented"}