sharing: improve resolving function
This commit is contained in:
@@ -346,28 +346,33 @@ class BaseSharing:
|
|||||||
# resolves a path to a share
|
# resolves a path to a share
|
||||||
def sharing_collection_resolver(self, path: str, user: str) -> Union[dict, None]:
|
def sharing_collection_resolver(self, path: str, user: str) -> Union[dict, None]:
|
||||||
""" returning dict with PathMapped, Owner, Permissions or None if not found"""
|
""" returning dict with PathMapped, Owner, Permissions or None if not found"""
|
||||||
|
share = None
|
||||||
|
|
||||||
if self.sharing_collection_by_token:
|
if self.sharing_collection_by_token:
|
||||||
result = self.sharing_collection_by_token_resolver(path)
|
if share is None:
|
||||||
if result is not None:
|
share = self.sharing_collection_by_token_resolver(path)
|
||||||
return result
|
|
||||||
else:
|
|
||||||
# check for map
|
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
if logger.isEnabledFor(logging.DEBUG):
|
if logger.isEnabledFor(logging.DEBUG):
|
||||||
logger.debug("TRACE/sharing/token: not active")
|
logger.debug("TRACE/sharing/token: not active")
|
||||||
pass
|
|
||||||
|
|
||||||
if self.sharing_collection_by_map:
|
if self.sharing_collection_by_map:
|
||||||
result = self.sharing_collection_by_map_resolver(path, user)
|
if share is None:
|
||||||
if result is not None:
|
share = self.sharing_collection_by_map_resolver(path, user)
|
||||||
return result
|
|
||||||
else:
|
else:
|
||||||
if logger.isEnabledFor(logging.DEBUG):
|
if logger.isEnabledFor(logging.DEBUG):
|
||||||
logger.debug("TRACE/sharing/map: not active")
|
logger.debug("TRACE/sharing/map: not active")
|
||||||
pass
|
|
||||||
|
|
||||||
return None
|
if share is not None:
|
||||||
|
if self.permit_properties_overlay:
|
||||||
|
if share['Permissions'] and "p" not in share['Permissions']:
|
||||||
|
# add permit permission
|
||||||
|
share['Permissions'] += "P"
|
||||||
|
else:
|
||||||
|
if share['Permissions'] and "P" not in share['Permissions']:
|
||||||
|
# add deny permission
|
||||||
|
share['Permissions'] += "p"
|
||||||
|
|
||||||
|
return share
|
||||||
|
|
||||||
# adjust a share
|
# adjust a share
|
||||||
def sharing_collection_update(self, ShareType: str, PathOrToken: str, OwnerOrUser: str, Properties: dict) -> None:
|
def sharing_collection_update(self, ShareType: str, PathOrToken: str, OwnerOrUser: str, Properties: dict) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user