-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1584 from pbiering/change-default-permit_delete_c…
…ollection permit_delete_collection per collection control
- Loading branch information
Showing
5 changed files
with
62 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
# Copyright © 2008 Pascal Halter | ||
# Copyright © 2008-2017 Guillaume Ayoub | ||
# Copyright © 2017-2018 Unrud <[email protected]> | ||
# Copyright © 2024-2024 Peter Bieringer <[email protected]> | ||
# | ||
# This library is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
|
@@ -24,6 +25,7 @@ | |
from radicale import httputils, storage, types, xmlutils | ||
from radicale.app.base import Access, ApplicationBase | ||
from radicale.hook import HookNotificationItem, HookNotificationItemTypes | ||
from radicale.log import logger | ||
|
||
|
||
def xml_delete(base_prefix: str, path: str, collection: storage.BaseCollection, | ||
|
@@ -71,17 +73,22 @@ def do_DELETE(self, environ: types.WSGIEnviron, base_prefix: str, | |
hook_notification_item_list = [] | ||
if isinstance(item, storage.BaseCollection): | ||
if self._permit_delete_collection: | ||
for i in item.get_all(): | ||
hook_notification_item_list.append( | ||
HookNotificationItem( | ||
HookNotificationItemTypes.DELETE, | ||
access.path, | ||
i.uid | ||
) | ||
) | ||
xml_answer = xml_delete(base_prefix, path, item) | ||
if access.check("d", item): | ||
logger.info("delete of collection is permitted by config/option [rights] permit_delete_collection but explicit forbidden by permission 'd': %s", path) | ||
return httputils.NOT_ALLOWED | ||
else: | ||
return httputils.NOT_ALLOWED | ||
if not access.check("D", item): | ||
logger.info("delete of collection is prevented by config/option [rights] permit_delete_collection and not explicit allowed by permission 'D': %s", path) | ||
return httputils.NOT_ALLOWED | ||
for i in item.get_all(): | ||
hook_notification_item_list.append( | ||
HookNotificationItem( | ||
HookNotificationItemTypes.DELETE, | ||
access.path, | ||
i.uid | ||
) | ||
) | ||
xml_answer = xml_delete(base_prefix, path, item) | ||
else: | ||
assert item.collection is not None | ||
assert item.href is not None | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters