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 #81162

Merged
merged 3 commits into from
Nov 22, 2024

Conversation

oioki
Copy link
Member

@oioki oioki commented Nov 21, 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:

has_access = bool(
is_member
or is_superuser
or project.organization.flags.allow_joinleave
or (org_role and roles.get(org_role).is_global)
)

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:

@oioki oioki requested review from a team November 21, 2024 23:06
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 21, 2024
Copy link

codecov bot commented Nov 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #81162   +/-   ##
=======================================
  Coverage   80.33%   80.34%           
=======================================
  Files        7223     7223           
  Lines      320107   320060   -47     
  Branches    20779    20772    -7     
=======================================
- Hits       257163   257140   -23     
+ Misses      62551    62527   -24     
  Partials      393      393           

@oioki oioki merged commit 2e810df into master Nov 22, 2024
50 checks passed
@oioki oioki deleted the fix/hide-stats-when-no-project-access-2 branch November 22, 2024 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants