sharing: adjust result codes for unsupported calls
This commit is contained in:
@@ -947,7 +947,7 @@ class BaseSharing:
|
|||||||
Conversion = request_data['Conversion']
|
Conversion = request_data['Conversion']
|
||||||
# verify against whitelist
|
# verify against whitelist
|
||||||
if Conversion not in CONVERSIONS_WHITELIST:
|
if Conversion not in CONVERSIONS_WHITELIST:
|
||||||
return httputils.bad_request("Conversion not supported: %r" % Conversion)
|
return httputils.bad_request("Conversion is not supported: %r" % Conversion)
|
||||||
|
|
||||||
if 'Actions' in request_data:
|
if 'Actions' in request_data:
|
||||||
valid = True # default
|
valid = True # default
|
||||||
@@ -1060,11 +1060,11 @@ class BaseSharing:
|
|||||||
return httputils.NOT_FOUND
|
return httputils.NOT_FOUND
|
||||||
if not isinstance(item, storage.BaseCollection):
|
if not isinstance(item, storage.BaseCollection):
|
||||||
logger.warning(api_info + ": PathMapped=%r is not a collection", PathMapped)
|
logger.warning(api_info + ": PathMapped=%r is not a collection", PathMapped)
|
||||||
return httputils.METHOD_NOT_ALLOWED
|
return httputils.bad_request("PathMapped is not a collection")
|
||||||
if Conversion == "bday":
|
if Conversion == "bday":
|
||||||
if item.tag != "VADDRESSBOOK":
|
if item.tag != "VADDRESSBOOK":
|
||||||
logger.warning(api_info + ": PathMapped=%r is not a VADDRESSBOOK collection (mandatory for Conversion=%r)", PathMapped, Conversion)
|
logger.warning(api_info + ": PathMapped=%r is not a VADDRESSBOOK collection (mandatory for Conversion=%r)", PathMapped, Conversion)
|
||||||
return httputils.METHOD_NOT_ALLOWED
|
return httputils.bad_request("Conversion is not supported for collection type")
|
||||||
|
|
||||||
if Permissions is None:
|
if Permissions is None:
|
||||||
if ShareType == "token":
|
if ShareType == "token":
|
||||||
@@ -1081,7 +1081,7 @@ class BaseSharing:
|
|||||||
for permission in Permissions:
|
for permission in Permissions:
|
||||||
if permission not in "rPp":
|
if permission not in "rPp":
|
||||||
logger.warning(api_info + ": PathMapped=%r Permissions=%r not supported for Conversion=%r", PathMapped, Permissions, Conversion)
|
logger.warning(api_info + ": PathMapped=%r Permissions=%r not supported for Conversion=%r", PathMapped, Permissions, Conversion)
|
||||||
return httputils.METHOD_NOT_ALLOWED
|
return httputils.bad_request("Permissions are not supported for conversion")
|
||||||
|
|
||||||
if Enabled is None:
|
if Enabled is None:
|
||||||
Enabled = False # security by default
|
Enabled = False # security by default
|
||||||
@@ -1299,7 +1299,7 @@ class BaseSharing:
|
|||||||
for permission in Permissions:
|
for permission in Permissions:
|
||||||
if permission not in "rPp":
|
if permission not in "rPp":
|
||||||
logger.warning(api_info + ": PathMapped=%r Permissions=%r not supported for Conversion=%r", PathMapped, Permissions, Conversion)
|
logger.warning(api_info + ": PathMapped=%r Permissions=%r not supported for Conversion=%r", PathMapped, Permissions, Conversion)
|
||||||
return httputils.METHOD_NOT_ALLOWED
|
return httputils.bad_request("Permissions are not supported for conversion")
|
||||||
|
|
||||||
if user == share['Owner']:
|
if user == share['Owner']:
|
||||||
if PathMapped is not None:
|
if PathMapped is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user