Loading services/TS29222_CAPIF_Auditing_API/logs/core/validate_user.py +5 −6 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ from ..encoder import CustomJSONEncoder from ..models.problem_details import ProblemDetails from ..util import serialize_clean_camel_case from .resources import Resource from .responses import internal_server_error from .responses import internal_server_error, not_found_error, forbidden_error class ControlAccess(Resource): Loading @@ -19,11 +19,10 @@ class ControlAccess(Resource): my_query = {'cert_signature': cert_signature} cert_entry = cert_col.find_one(my_query) if cert_entry is not None: if cert_entry["role"] != "AMF": prob = ProblemDetails(title="Unauthorized", detail="User not authorized", cause="You are not the owner of this resource") prob = serialize_clean_camel_case(prob) return Response(json.dumps(prob, cls=CustomJSONEncoder), status=401, mimetype="application/json") if cert_entry is None: return not_found_error(detail="Certificate not found", cause="No certificate matches the provided signature") elif cert_entry["role"] != "AMF": return forbidden_error(detail="User not authorized", cause="You are not the owner of this resource") except Exception as e: exception = "An exception occurred in validate invoker" Loading Loading
services/TS29222_CAPIF_Auditing_API/logs/core/validate_user.py +5 −6 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ from ..encoder import CustomJSONEncoder from ..models.problem_details import ProblemDetails from ..util import serialize_clean_camel_case from .resources import Resource from .responses import internal_server_error from .responses import internal_server_error, not_found_error, forbidden_error class ControlAccess(Resource): Loading @@ -19,11 +19,10 @@ class ControlAccess(Resource): my_query = {'cert_signature': cert_signature} cert_entry = cert_col.find_one(my_query) if cert_entry is not None: if cert_entry["role"] != "AMF": prob = ProblemDetails(title="Unauthorized", detail="User not authorized", cause="You are not the owner of this resource") prob = serialize_clean_camel_case(prob) return Response(json.dumps(prob, cls=CustomJSONEncoder), status=401, mimetype="application/json") if cert_entry is None: return not_found_error(detail="Certificate not found", cause="No certificate matches the provided signature") elif cert_entry["role"] != "AMF": return forbidden_error(detail="User not authorized", cause="You are not the owner of this resource") except Exception as e: exception = "An exception occurred in validate invoker" Loading