-
Notifications
You must be signed in to change notification settings - Fork 28
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: Restrict deactivated enterprise user access #910
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #910 +/- ##
=======================================
Coverage 96.25% 96.25%
=======================================
Files 826 826
Lines 19048 19051 +3
=======================================
+ Hits 18334 18337 +3
Misses 714 714
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. 📢 Thoughts on this report? Let us know! |
# per product spec, if guestAccess is off for the environment, the current enterpriseUser | ||
# must be "activated" in the given target owner (e.g., "codecov" org) in order to see things | ||
target = await get_owner(service, username) | ||
if user.ownerid not in target.plan_activated_users: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use this helper function: current_user_part_of_org
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nice thanks!
Looking over that helper - Are we diligent about updating an owner (say suejung-sentry
)'s organizations
when we adjust the other source of truth on the organization (say codecov
)'s plan_activated_users
?
From what I could tell the term activated
relates to whether the ownerid in the plan_activated_users
list, and I haven't dug yet into what the owner.organizations is, but I thought it had to do with accounts
?
This stuff makes it seem like they are 2 separate concepts, so using the helper will result in a different effect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -50,11 +52,17 @@ def resolve_owner(_, info, username): | |||
if not user or not user.is_authenticated: | |||
raise UnauthorizedGuestAccess() | |||
|
|||
return get_owner(service, username) | |||
# per product spec, if guestAccess is off for the environment, the current enterpriseUser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think the comment states something that can be inferred from the code / PR if needed so not sure if there's much value in having it tbh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Restrict what deactivated Enterprise users can see when the environment has guest access turned off
Closes codecov/engineering-team#1859