Skip to content
Snippets Groups Projects
Commit 1b1d669f authored by Simon Künzel's avatar Simon Künzel
Browse files

Make ORIGINAL_IP_HEADER_NAME optional

parent 839efab6
No related branches found
No related tags found
No related merge requests found
Pipeline #7737 passed
Pipeline: backend

#7739

    ......@@ -18,7 +18,7 @@ from api.database import *
    import api
    _BASE_URL = api.config["API_BASE_URL"]
    _ORIGINAL_IP_HEADER_NAME = api.config["ORIGINAL_IP_HEADER_NAME"]
    _ORIGINAL_IP_HEADER_NAME = api.config.get("ORIGINAL_IP_HEADER_NAME")
    def api_moderator_route(require_csrf_token: bool = False):
    ......@@ -111,7 +111,7 @@ def are_view_permissions_fulfilled(perm: ViewPermissions):
    if isinstance(perm, ViewPermissionsAuthentication):
    if perm.rwth_authentication and (
    api_session.is_rwth_authenticated
    or (_ORIGINAL_IP_HEADER_NAME in request.headers and is_rwth_ip(request.headers[_ORIGINAL_IP_HEADER_NAME]))
    or (_ORIGINAL_IP_HEADER_NAME is not None and _ORIGINAL_IP_HEADER_NAME in request.headers and is_rwth_ip(request.headers[_ORIGINAL_IP_HEADER_NAME]))
    ):
    return True
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment