Merge pull request #1991 from pbiering/feature-sharing-prepare2
Feature sharing prepare#2
This commit is contained in:
@@ -67,6 +67,8 @@ class ApplicationPartMove(ApplicationBase):
|
|||||||
# Remote destination server, not supported
|
# Remote destination server, not supported
|
||||||
return httputils.REMOTE_DESTINATION
|
return httputils.REMOTE_DESTINATION
|
||||||
|
|
||||||
|
to_user = user
|
||||||
|
to_permissions_filter = None
|
||||||
permissions_filter = None
|
permissions_filter = None
|
||||||
access = Access(self._rights, user, path, permissions_filter)
|
access = Access(self._rights, user, path, permissions_filter)
|
||||||
if not access.check("w"):
|
if not access.check("w"):
|
||||||
@@ -77,8 +79,6 @@ class ApplicationPartMove(ApplicationBase):
|
|||||||
"start with base prefix", to_path, path)
|
"start with base prefix", to_path, path)
|
||||||
return httputils.NOT_ALLOWED
|
return httputils.NOT_ALLOWED
|
||||||
to_path = to_path[len(base_prefix):]
|
to_path = to_path[len(base_prefix):]
|
||||||
to_user = user
|
|
||||||
to_permissions_filter = None
|
|
||||||
to_access = Access(self._rights, to_user, to_path, to_permissions_filter)
|
to_access = Access(self._rights, to_user, to_path, to_permissions_filter)
|
||||||
if not to_access.check("w"):
|
if not to_access.check("w"):
|
||||||
return httputils.NOT_ALLOWED
|
return httputils.NOT_ALLOWED
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# Copyright © 2008-2017 Guillaume Ayoub
|
# Copyright © 2008-2017 Guillaume Ayoub
|
||||||
# Copyright © 2017-2020 Unrud <unrud@outlook.com>
|
# Copyright © 2017-2020 Unrud <unrud@outlook.com>
|
||||||
# Copyright © 2020-2023 Tuna Celik <tuna@jakpark.com>
|
# Copyright © 2020-2023 Tuna Celik <tuna@jakpark.com>
|
||||||
# Copyright © 2024-2025 Peter Bieringer <pb@bieringer.de>
|
# Copyright © 2024-2026 Peter Bieringer <pb@bieringer.de>
|
||||||
#
|
#
|
||||||
# This library is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -181,7 +181,8 @@ class ApplicationPartPut(ApplicationBase):
|
|||||||
def do_PUT(self, environ: types.WSGIEnviron, base_prefix: str,
|
def do_PUT(self, environ: types.WSGIEnviron, base_prefix: str,
|
||||||
path: str, user: str, remote_host: str, remote_useragent: str) -> types.WSGIResponse:
|
path: str, user: str, remote_host: str, remote_useragent: str) -> types.WSGIResponse:
|
||||||
"""Manage PUT request."""
|
"""Manage PUT request."""
|
||||||
access = Access(self._rights, user, path)
|
permissions_filter = None
|
||||||
|
access = Access(self._rights, user, path, permissions_filter)
|
||||||
if not access.check("w"):
|
if not access.check("w"):
|
||||||
return httputils.NOT_ALLOWED
|
return httputils.NOT_ALLOWED
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# Copyright © 2008 Pascal Halter
|
# Copyright © 2008 Pascal Halter
|
||||||
# Copyright © 2008-2017 Guillaume Ayoub
|
# Copyright © 2008-2017 Guillaume Ayoub
|
||||||
# Copyright © 2017-2022 Unrud <unrud@outlook.com>
|
# Copyright © 2017-2022 Unrud <unrud@outlook.com>
|
||||||
# Copyright © 2024-2025 Peter Bieringer <pb@bieringer.de>
|
# Copyright © 2024-2026 Peter Bieringer <pb@bieringer.de>
|
||||||
#
|
#
|
||||||
# This library is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -106,6 +106,10 @@ MIMETYPES: Mapping[str, str] = {
|
|||||||
FALLBACK_MIMETYPE: str = "application/octet-stream"
|
FALLBACK_MIMETYPE: str = "application/octet-stream"
|
||||||
|
|
||||||
|
|
||||||
|
def bad_request(additional_details: str) -> types.WSGIResponse:
|
||||||
|
return (client.BAD_REQUEST, (("Content-Type", "text/plain"),), f"Bad Request: {additional_details}", None)
|
||||||
|
|
||||||
|
|
||||||
def decode_request(configuration: "config.Configuration",
|
def decode_request(configuration: "config.Configuration",
|
||||||
environ: types.WSGIEnviron, text: bytes) -> str:
|
environ: types.WSGIEnviron, text: bytes) -> str:
|
||||||
"""Try to magically decode ``text`` according to given ``environ``."""
|
"""Try to magically decode ``text`` according to given ``environ``."""
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ class BaseTest:
|
|||||||
(str, type(http_if_match)))
|
(str, type(http_if_match)))
|
||||||
remote_useragent = kwargs.pop("remote_useragent", None)
|
remote_useragent = kwargs.pop("remote_useragent", None)
|
||||||
remote_host = kwargs.pop("remote_host", None)
|
remote_host = kwargs.pop("remote_host", None)
|
||||||
|
content_type = kwargs.pop("content_type", None)
|
||||||
|
accept = kwargs.pop("accept", None)
|
||||||
environ: Dict[str, Any] = {k.upper(): v for k, v in kwargs.items()}
|
environ: Dict[str, Any] = {k.upper(): v for k, v in kwargs.items()}
|
||||||
for k, v in environ.items():
|
for k, v in environ.items():
|
||||||
if not isinstance(v, str):
|
if not isinstance(v, str):
|
||||||
@@ -104,6 +106,10 @@ class BaseTest:
|
|||||||
environ["HTTP_USER_AGENT"] = remote_useragent
|
environ["HTTP_USER_AGENT"] = remote_useragent
|
||||||
if remote_host:
|
if remote_host:
|
||||||
environ["REMOTE_ADDR"] = remote_host
|
environ["REMOTE_ADDR"] = remote_host
|
||||||
|
if content_type:
|
||||||
|
environ["CONTENT_TYPE"] = content_type
|
||||||
|
if accept:
|
||||||
|
environ["HTTP_ACCEPT"] = accept
|
||||||
environ["REQUEST_METHOD"] = method.upper()
|
environ["REQUEST_METHOD"] = method.upper()
|
||||||
environ["PATH_INFO"] = path
|
environ["PATH_INFO"] = path
|
||||||
if data is not None:
|
if data is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user