<commit_before>from __future__ import absolute_import

from sentry.api.bases import OrganizationEndpoint
from sentry.api.paginator import DateTimePaginator
from sentry.api.serializers import serialize, OrganizationActivitySerializer
from sentry.models import Activity


class OrganizationActivityEndpoint(OrganizationEndpoint):
    def get(self, request, organization):
        queryset = Activity.objects.filter(
            project__organization=organization,
        ).select_related('project', 'user')

        return self.paginate(<commit_msg>Restrict organization activity to user scope<commit_after>from __future__ import absolute_import

from sentry.api.bases import OrganizationMemberEndpoint
from sentry.api.paginator import DateTimePaginator
from sentry.api.serializers import serialize, OrganizationActivitySerializer
from sentry.models import Activity, OrganizationMemberTeam, Project


class OrganizationActivityEndpoint(OrganizationMemberEndpoint):
    def get(self, request, organization, member):
        queryset = Activity.objects.filter(
            project__in=Project.objects.filter(
                organization=organization,
                team__in=OrganizationMemberTeam.objects.filter(
                    organizationmember=member,
                    is_active=True,
                ).values('team')
            )
        ).select_related('project', 'user')

        return self.paginate(
{'fraction_non_alphanumeric': 0.06633733239237827, 'fraction_numerical': 0.0, 'mean_word_length': 3.7583892617449663, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7052855', 'n_tokens_mistral': 333, 'n_tokens_neox': 321, 'n_words': 80}