Loading services/TS29222_CAPIF_Events_API/capif_events/core/notifications.py +3 −2 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ import json from flask import current_app import asyncio import aiohttp from util import dict_to_camel_case, clean_empty class Notifications(): Loading @@ -33,9 +34,9 @@ class Notifications(): event_detail={redis_event.get('key'):redis_event.get('information')} current_app.logger.debug(event_detail) data = EventNotification(sub["subscription_id"], events=redis_event.get('event'), event_detail=event_detail) current_app.logger.debug(json.dumps(data,cls=JSONEncoder)) current_app.logger.debug(json.dumps(data.to_dict(),cls=JSONEncoder)) asyncio.run(self.send(url, json.loads(json.dumps(data,cls=JSONEncoder)))) asyncio.run(self.send(url, dict_to_camel_case(clean_empty(data.to_dict())))) except Exception as e: current_app.logger.error("An exception occurred ::" + str(e)) Loading services/TS29222_CAPIF_Events_API/capif_events/core/validate_user.py +6 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ from ..models.problem_details import ProblemDetails from ..encoder import JSONEncoder from .resources import Resource from .responses import internal_server_error from ..util import dict_to_camel_case, clean_empty class ControlAccess(Resource): Loading @@ -18,6 +19,11 @@ class ControlAccess(Resource): if cert_entry is not None: if cert_entry["cert_signature"] != cert_signature or "event_subscriptions" not in cert_entry["resources"] or event_id not in cert_entry["resources"]["event_subscriptions"]: prob = ProblemDetails(title="Unauthorized", detail="User not authorized", cause="You are not the owner of this resource") prob = prob.to_dict() prob = clean_empty(prob) prob = dict_to_camel_case(prob) return Response(json.dumps(prob, cls=JSONEncoder), status=401, mimetype="application/json") except Exception as e: Loading services/TS29222_CAPIF_Logging_API_Invocation_API/api_invocation_logs/core/invocationlogs.py +2 −2 Original line number Diff line number Diff line Loading @@ -80,7 +80,7 @@ class LoggingInvocationOperations(Resource): current_app.logger.debug("Check service apis") event=None invocation_log_base=json.loads(json.dumps(invocationlog, cls=JSONEncoder)) invocation_log_base=json.loads(json.dumps(invocationlog.to_dict(), cls=JSONEncoder)) for log in invocationlog.logs: result = self.__check_service_apis(log.api_id, log.api_name) Loading @@ -97,7 +97,7 @@ class LoggingInvocationOperations(Resource): event="SERVICE_API_INVOCATION_FAILURE" current_app.logger.info(event) invocation_log_base['logs']=[log] invocation_log_base['logs']=[log.to_dict()] invocationLogs=[invocation_log_base] RedisEvent(event,"invocationLogs",invocationLogs).send_event() Loading services/register/register_service/core/register_operations.py +1 −1 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ class RegisterOperations: try: url = f"https://capifcore/helper/deleteEntities/{uuid}" requests.delete(url, cert=("register_service/certs/superadmin.crt", "register_service/certs/superadmin.key"), verify="register_service/certs/ca_root.crt") requests.delete(url, cert=("certs/superadmin.crt", "certs/superadmin.key"), verify="certs/ca_root.crt") mycol.delete_one({"uuid": uuid}) Loading Loading
services/TS29222_CAPIF_Events_API/capif_events/core/notifications.py +3 −2 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ import json from flask import current_app import asyncio import aiohttp from util import dict_to_camel_case, clean_empty class Notifications(): Loading @@ -33,9 +34,9 @@ class Notifications(): event_detail={redis_event.get('key'):redis_event.get('information')} current_app.logger.debug(event_detail) data = EventNotification(sub["subscription_id"], events=redis_event.get('event'), event_detail=event_detail) current_app.logger.debug(json.dumps(data,cls=JSONEncoder)) current_app.logger.debug(json.dumps(data.to_dict(),cls=JSONEncoder)) asyncio.run(self.send(url, json.loads(json.dumps(data,cls=JSONEncoder)))) asyncio.run(self.send(url, dict_to_camel_case(clean_empty(data.to_dict())))) except Exception as e: current_app.logger.error("An exception occurred ::" + str(e)) Loading
services/TS29222_CAPIF_Events_API/capif_events/core/validate_user.py +6 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ from ..models.problem_details import ProblemDetails from ..encoder import JSONEncoder from .resources import Resource from .responses import internal_server_error from ..util import dict_to_camel_case, clean_empty class ControlAccess(Resource): Loading @@ -18,6 +19,11 @@ class ControlAccess(Resource): if cert_entry is not None: if cert_entry["cert_signature"] != cert_signature or "event_subscriptions" not in cert_entry["resources"] or event_id not in cert_entry["resources"]["event_subscriptions"]: prob = ProblemDetails(title="Unauthorized", detail="User not authorized", cause="You are not the owner of this resource") prob = prob.to_dict() prob = clean_empty(prob) prob = dict_to_camel_case(prob) return Response(json.dumps(prob, cls=JSONEncoder), status=401, mimetype="application/json") except Exception as e: Loading
services/TS29222_CAPIF_Logging_API_Invocation_API/api_invocation_logs/core/invocationlogs.py +2 −2 Original line number Diff line number Diff line Loading @@ -80,7 +80,7 @@ class LoggingInvocationOperations(Resource): current_app.logger.debug("Check service apis") event=None invocation_log_base=json.loads(json.dumps(invocationlog, cls=JSONEncoder)) invocation_log_base=json.loads(json.dumps(invocationlog.to_dict(), cls=JSONEncoder)) for log in invocationlog.logs: result = self.__check_service_apis(log.api_id, log.api_name) Loading @@ -97,7 +97,7 @@ class LoggingInvocationOperations(Resource): event="SERVICE_API_INVOCATION_FAILURE" current_app.logger.info(event) invocation_log_base['logs']=[log] invocation_log_base['logs']=[log.to_dict()] invocationLogs=[invocation_log_base] RedisEvent(event,"invocationLogs",invocationLogs).send_event() Loading
services/register/register_service/core/register_operations.py +1 −1 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ class RegisterOperations: try: url = f"https://capifcore/helper/deleteEntities/{uuid}" requests.delete(url, cert=("register_service/certs/superadmin.crt", "register_service/certs/superadmin.key"), verify="register_service/certs/ca_root.crt") requests.delete(url, cert=("certs/superadmin.crt", "certs/superadmin.key"), verify="certs/ca_root.crt") mycol.delete_one({"uuid": uuid}) Loading