-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
the
Scope: Backend
Automatically applied to PRs that change backend components
label
Nov 8, 2024
geoffg-sentry
approved these changes
Nov 8, 2024
PR reverted: e6afdb4 |
getsentry-bot
added a commit
that referenced
this pull request
Nov 12, 2024
This reverts commit aecb53c. Co-authored-by: dashed <[email protected]>
@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: ```
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)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
sentry/src/sentry/api/endpoints/organization_stats_v2.py
Line 202 in 0b9d9f8
These stats are used only by projectCard.tsx in the list of projects:
Which are not visible when there is no access to a project, so it should be a safe change.