sharing: share-by-group: add share resolution for other methods beside propfind
This commit is contained in:
@@ -23,7 +23,7 @@ from http import client
|
|||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
|
|
||||||
from radicale import httputils, storage, types, xmlutils
|
from radicale import httputils, sharing, storage, types, xmlutils
|
||||||
from radicale.app.base import Access, ApplicationBase
|
from radicale.app.base import Access, ApplicationBase
|
||||||
from radicale.hook import HookNotificationItem, HookNotificationItemTypes
|
from radicale.hook import HookNotificationItem, HookNotificationItemTypes
|
||||||
from radicale.log import logger
|
from radicale.log import logger
|
||||||
@@ -71,6 +71,10 @@ class ApplicationPartDelete(ApplicationBase):
|
|||||||
if self._sharing._enabled:
|
if self._sharing._enabled:
|
||||||
# Sharing by token or map (if enabled)
|
# Sharing by token or map (if enabled)
|
||||||
share = self._sharing.sharing_collection_resolver(path, user)
|
share = self._sharing.sharing_collection_resolver(path, user)
|
||||||
|
user_lookup = user
|
||||||
|
if self._rights._user_groups is not None and len(self._rights._user_groups) > 0:
|
||||||
|
user_lookup += sharing.SHARING_SEPARATOR_GROUP + ','.join(self._rights._user_groups)
|
||||||
|
share = self._sharing.sharing_collection_resolver(path, user_lookup)
|
||||||
if share:
|
if share:
|
||||||
# overwrite and run through extended permission check
|
# overwrite and run through extended permission check
|
||||||
path = share['PathMapped']
|
path = share['PathMapped']
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ from http import client
|
|||||||
from typing import Union
|
from typing import Union
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
|
|
||||||
from radicale import httputils, pathutils, storage, types, xmlutils
|
from radicale import httputils, pathutils, sharing, storage, types, xmlutils
|
||||||
from radicale.app.base import Access, ApplicationBase
|
from radicale.app.base import Access, ApplicationBase
|
||||||
from radicale.log import logger
|
from radicale.log import logger
|
||||||
|
|
||||||
@@ -89,7 +89,10 @@ class ApplicationPartGet(ApplicationBase):
|
|||||||
share = None
|
share = None
|
||||||
if self._sharing._enabled:
|
if self._sharing._enabled:
|
||||||
# Sharing by token or map (if enabled)
|
# Sharing by token or map (if enabled)
|
||||||
share = self._sharing.sharing_collection_resolver(path, user)
|
user_lookup = user
|
||||||
|
if self._rights._user_groups is not None and len(self._rights._user_groups) > 0:
|
||||||
|
user_lookup += sharing.SHARING_SEPARATOR_GROUP + ','.join(self._rights._user_groups)
|
||||||
|
share = self._sharing.sharing_collection_resolver(path, user_lookup)
|
||||||
if share:
|
if share:
|
||||||
# overwrite and run through extended permission check
|
# overwrite and run through extended permission check
|
||||||
path = share['PathMapped']
|
path = share['PathMapped']
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import re
|
|||||||
from http import client
|
from http import client
|
||||||
from urllib.parse import unquote, urlparse
|
from urllib.parse import unquote, urlparse
|
||||||
|
|
||||||
from radicale import httputils, pathutils, storage, types
|
from radicale import httputils, pathutils, sharing, storage, types
|
||||||
from radicale.app import base as app_base
|
from radicale.app import base as app_base
|
||||||
from radicale.app.base import Access, ApplicationBase
|
from radicale.app.base import Access, ApplicationBase
|
||||||
from radicale.log import logger
|
from radicale.log import logger
|
||||||
@@ -73,7 +73,10 @@ class ApplicationPartMove(ApplicationBase):
|
|||||||
permissions_filter = None
|
permissions_filter = None
|
||||||
if self._sharing._enabled:
|
if self._sharing._enabled:
|
||||||
# Sharing by token or map (if enabled)
|
# Sharing by token or map (if enabled)
|
||||||
share = self._sharing.sharing_collection_resolver(path, user)
|
user_lookup = user
|
||||||
|
if self._rights._user_groups is not None and len(self._rights._user_groups) > 0:
|
||||||
|
user_lookup += sharing.SHARING_SEPARATOR_GROUP + ','.join(self._rights._user_groups)
|
||||||
|
share = self._sharing.sharing_collection_resolver(path, user_lookup)
|
||||||
if share:
|
if share:
|
||||||
# overwrite and run through extended permission check
|
# overwrite and run through extended permission check
|
||||||
path = share['PathMapped']
|
path = share['PathMapped']
|
||||||
@@ -93,7 +96,10 @@ class ApplicationPartMove(ApplicationBase):
|
|||||||
to_path = to_path[len(base_prefix):]
|
to_path = to_path[len(base_prefix):]
|
||||||
if self._sharing._enabled:
|
if self._sharing._enabled:
|
||||||
# Sharing by token or map (if enabled)
|
# Sharing by token or map (if enabled)
|
||||||
share = self._sharing.sharing_collection_resolver(to_path, to_user)
|
to_user_lookup = to_user
|
||||||
|
if self._rights._user_groups is not None and len(self._rights._user_groups) > 0:
|
||||||
|
to_user_lookup += sharing.SHARING_SEPARATOR_GROUP + ','.join(self._rights._user_groups)
|
||||||
|
share = self._sharing.sharing_collection_resolver(to_path, to_user_lookup)
|
||||||
if share:
|
if share:
|
||||||
# overwrite and run through extended permission check
|
# overwrite and run through extended permission check
|
||||||
to_path = share['PathMapped']
|
to_path = share['PathMapped']
|
||||||
|
|||||||
@@ -588,7 +588,10 @@ class ApplicationPartPropfind(ApplicationBase):
|
|||||||
allowed_items: list = []
|
allowed_items: list = []
|
||||||
if self._sharing._enabled:
|
if self._sharing._enabled:
|
||||||
# Sharing by token or map (if enabled)
|
# Sharing by token or map (if enabled)
|
||||||
share = self._sharing.sharing_collection_resolver(path, user)
|
user_lookup = user
|
||||||
|
if self._rights._user_groups is not None and len(self._rights._user_groups) > 0:
|
||||||
|
user_lookup += sharing.SHARING_SEPARATOR_GROUP + ','.join(self._rights._user_groups)
|
||||||
|
share = self._sharing.sharing_collection_resolver(path, user_lookup)
|
||||||
if share:
|
if share:
|
||||||
# overwrite and run through extended permission check
|
# overwrite and run through extended permission check
|
||||||
path = share['PathMapped']
|
path = share['PathMapped']
|
||||||
|
|||||||
@@ -107,7 +107,10 @@ class ApplicationPartProppatch(ApplicationBase):
|
|||||||
path_orig = path
|
path_orig = path
|
||||||
if self._sharing._enabled:
|
if self._sharing._enabled:
|
||||||
# Sharing by token or map (if enabled)
|
# Sharing by token or map (if enabled)
|
||||||
share = self._sharing.sharing_collection_resolver(path, user)
|
user_lookup = user
|
||||||
|
if self._rights._user_groups is not None and len(self._rights._user_groups) > 0:
|
||||||
|
user_lookup += sharing.SHARING_SEPARATOR_GROUP + ','.join(self._rights._user_groups)
|
||||||
|
share = self._sharing.sharing_collection_resolver(path, user_lookup)
|
||||||
if share:
|
if share:
|
||||||
# overwrite and run through extended permission check
|
# overwrite and run through extended permission check
|
||||||
path = share['PathMapped']
|
path = share['PathMapped']
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ from typing import Iterator, List, Mapping, MutableMapping, Optional, Tuple
|
|||||||
import vobject
|
import vobject
|
||||||
|
|
||||||
import radicale.item as radicale_item
|
import radicale.item as radicale_item
|
||||||
from radicale import (httputils, pathutils, rights, storage, types, utils,
|
from radicale import (httputils, pathutils, rights, sharing, storage, types,
|
||||||
xmlutils)
|
utils, xmlutils)
|
||||||
from radicale.app.base import Access, ApplicationBase
|
from radicale.app.base import Access, ApplicationBase
|
||||||
from radicale.hook import HookNotificationItem, HookNotificationItemTypes
|
from radicale.hook import HookNotificationItem, HookNotificationItemTypes
|
||||||
from radicale.log import logger
|
from radicale.log import logger
|
||||||
@@ -188,7 +188,10 @@ class ApplicationPartPut(ApplicationBase):
|
|||||||
permissions_filter = None
|
permissions_filter = None
|
||||||
if self._sharing._enabled:
|
if self._sharing._enabled:
|
||||||
# Sharing by token or map (if enabled)
|
# Sharing by token or map (if enabled)
|
||||||
share = self._sharing.sharing_collection_resolver(path, user)
|
user_lookup = user
|
||||||
|
if self._rights._user_groups is not None and len(self._rights._user_groups) > 0:
|
||||||
|
user_lookup += sharing.SHARING_SEPARATOR_GROUP + ','.join(self._rights._user_groups)
|
||||||
|
share = self._sharing.sharing_collection_resolver(path, user_lookup)
|
||||||
if share:
|
if share:
|
||||||
# overwrite and run through extended permission check
|
# overwrite and run through extended permission check
|
||||||
path = share['PathMapped']
|
path = share['PathMapped']
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import vobject.base
|
|||||||
from vobject.base import ContentLine
|
from vobject.base import ContentLine
|
||||||
|
|
||||||
import radicale.item as radicale_item
|
import radicale.item as radicale_item
|
||||||
from radicale import httputils, pathutils, storage, types, xmlutils
|
from radicale import httputils, pathutils, sharing, storage, types, xmlutils
|
||||||
from radicale.app.base import Access, ApplicationBase
|
from radicale.app.base import Access, ApplicationBase
|
||||||
from radicale.item import filter as radicale_filter
|
from radicale.item import filter as radicale_filter
|
||||||
from radicale.log import logger
|
from radicale.log import logger
|
||||||
@@ -864,7 +864,10 @@ class ApplicationPartReport(ApplicationBase):
|
|||||||
share = None
|
share = None
|
||||||
if self._sharing._enabled:
|
if self._sharing._enabled:
|
||||||
# Sharing by token or map (if enabled)
|
# Sharing by token or map (if enabled)
|
||||||
share = self._sharing.sharing_collection_resolver(path, user)
|
user_lookup = user
|
||||||
|
if self._rights._user_groups is not None and len(self._rights._user_groups) > 0:
|
||||||
|
user_lookup += sharing.SHARING_SEPARATOR_GROUP + ','.join(self._rights._user_groups)
|
||||||
|
share = self._sharing.sharing_collection_resolver(path, user_lookup)
|
||||||
if share:
|
if share:
|
||||||
# overwrite and run through extended permission check
|
# overwrite and run through extended permission check
|
||||||
path = share['PathMapped']
|
path = share['PathMapped']
|
||||||
|
|||||||
Reference in New Issue
Block a user