Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(stats): hide stats if no project access #80447

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

oioki
Copy link
Member

@oioki oioki commented Nov 8, 2024

Hide stats, session stats, transaction stats, and options in project serialization if a user does not have access to the project.

This aligns with the behavior of OrganizationStatsEndpointV2 endpoint:

projects = self.get_projects(request, organization, project_ids=req_proj_ids)

These stats are used only by projectCard.tsx in the list of projects:
image
Which are not visible when there is no access to a project, so it should be a safe change.

@oioki oioki requested a review from a team November 8, 2024 13:14
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 8, 2024
@oioki oioki merged commit aecb53c into master Nov 12, 2024
52 checks passed
@oioki oioki deleted the fix/hide-stats-when-no-project-access branch November 12, 2024 10:36
@dashed dashed added the Trigger: Revert Add to a merged PR to revert it (skips CI) label Nov 12, 2024
@getsentry-bot
Copy link
Contributor

PR reverted: e6afdb4

getsentry-bot added a commit that referenced this pull request Nov 12, 2024
@dashed
Copy link
Member

dashed commented Nov 12, 2024

@oioki @geoffg-sentry This is breaking our internal admin pages which is a blocker for some Sentry employees. I've reverted this.

oioki added a commit that referenced this pull request Nov 22, 2024
Second attempt of #80447

Comparing with the previous attempt, we now also allow project stats for
staff users (`or user.is_staff`).

The superuser case is already covered in this code:

https://github.com/getsentry/sentry/blob/2e5e0654c717adfa569be7875f44cb7e2bda4a74/src/sentry/api/serializers/models/project.py#L131-L136
`is_superuser` is True, therefore `has_access` is True, and the first
condition in this snippet works:
```
if attrs["has_access"] or user.is_staff:
```
iamrajjoshi pushed a commit that referenced this pull request Nov 24, 2024
Second attempt of #80447

Comparing with the previous attempt, we now also allow project stats for
staff users (`or user.is_staff`).

The superuser case is already covered in this code:

https://github.com/getsentry/sentry/blob/2e5e0654c717adfa569be7875f44cb7e2bda4a74/src/sentry/api/serializers/models/project.py#L131-L136
`is_superuser` is True, therefore `has_access` is True, and the first
condition in this snippet works:
```
if attrs["has_access"] or user.is_staff:
```
harshithadurai pushed a commit that referenced this pull request Nov 25, 2024
Second attempt of #80447

Comparing with the previous attempt, we now also allow project stats for
staff users (`or user.is_staff`).

The superuser case is already covered in this code:

https://github.com/getsentry/sentry/blob/2e5e0654c717adfa569be7875f44cb7e2bda4a74/src/sentry/api/serializers/models/project.py#L131-L136
`is_superuser` is True, therefore `has_access` is True, and the first
condition in this snippet works:
```
if attrs["has_access"] or user.is_staff:
```
evanh pushed a commit that referenced this pull request Nov 25, 2024
Second attempt of #80447

Comparing with the previous attempt, we now also allow project stats for
staff users (`or user.is_staff`).

The superuser case is already covered in this code:

https://github.com/getsentry/sentry/blob/2e5e0654c717adfa569be7875f44cb7e2bda4a74/src/sentry/api/serializers/models/project.py#L131-L136
`is_superuser` is True, therefore `has_access` is True, and the first
condition in this snippet works:
```
if attrs["has_access"] or user.is_staff:
```
@github-actions github-actions bot locked and limited conversation to collaborators Nov 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components Trigger: Revert Add to a merged PR to revert it (skips CI)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants