From 387f1eb1da3edc16ded3dfcec779991580d53fc3 Mon Sep 17 00:00:00 2001 From: Alberto Leal Date: Tue, 15 Aug 2023 16:25:06 -0400 Subject: [PATCH] chore(hybrid-cloud): Update OrganizationAuditLogsEndpoint to be a control silo endpoint (#54755) --- .../api/endpoints/organization_auditlogs.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/sentry/api/endpoints/organization_auditlogs.py b/src/sentry/api/endpoints/organization_auditlogs.py index 2022091ce7da9..fd5822eda82f7 100644 --- a/src/sentry/api/endpoints/organization_auditlogs.py +++ b/src/sentry/api/endpoints/organization_auditlogs.py @@ -4,13 +4,17 @@ from sentry import audit_log from sentry.api.base import control_silo_endpoint -from sentry.api.bases import OrganizationEndpoint +from sentry.api.bases import ControlSiloOrganizationEndpoint from sentry.api.bases.organization import OrganizationAuditPermission from sentry.api.paginator import DateTimePaginator from sentry.api.serializers import serialize from sentry.audit_log.manager import AuditLogEventNotRegistered from sentry.db.models.fields.bounded import BoundedIntegerField from sentry.models import AuditLogEntry +from sentry.services.hybrid_cloud.organization.model import ( + RpcOrganization, + RpcUserOrganizationContext, +) class AuditLogQueryParamSerializer(serializers.Serializer): @@ -26,10 +30,15 @@ def validate_event(self, event): @control_silo_endpoint -class OrganizationAuditLogsEndpoint(OrganizationEndpoint): +class OrganizationAuditLogsEndpoint(ControlSiloOrganizationEndpoint): permission_classes = (OrganizationAuditPermission,) - def get(self, request: Request, organization) -> Response: + def get( + self, + request: Request, + organization_context: RpcUserOrganizationContext, + organization: RpcOrganization, + ) -> Response: queryset = AuditLogEntry.objects.filter(organization_id=organization.id).select_related( "actor" )