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: Restrict deactivated enterprise user access #910

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

suejung-sentry
Copy link
Contributor

Restrict what deactivated Enterprise users can see when the environment has guest access turned off

Closes codecov/engineering-team#1859

@suejung-sentry suejung-sentry requested a review from a team as a code owner October 22, 2024 07:12
Copy link

codecov bot commented Oct 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.25%. Comparing base (e8a5caf) to head (a6b4f36).

✅ 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           
Flag Coverage Δ
unit 92.50% <100.00%> (+<0.01%) ⬆️
unit-latest-uploader 92.50% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov-notifications
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@suejung-sentry suejung-sentry changed the title fix: Restrict deactiveated enterprise user access fix: Restrict deactivated enterprise user access Oct 22, 2024
# 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:
Copy link
Contributor

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

Copy link
Contributor Author

@suejung-sentry suejung-sentry Oct 22, 2024

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds like the helper may not be equivalent or what's desired here in this chat

Screenshot 2024-10-23 at 8 40 00 AM

@@ -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
Copy link
Contributor

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

Copy link
Contributor

@ajay-sentry ajay-sentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enterprise deactivated user repo visibility
3 participants