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

Add an admin action to remove stale plan_activated_users #778

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

Swatinem
Copy link
Contributor

Purpose/Motivation

Enterprise orgs often want to clean up their stale users to free up seats. This implements such an "admin" action.

Links to relevant tickets

What does this PR do?

This adds a new function which finds all the "stale" plan_activated_users for a set of given orgs. Users are considered stale if they don’t have any recent auth session or pull request. Those users will then be removed from the plan_activated_users.

@Swatinem Swatinem requested a review from a team August 28, 2024 11:30
@Swatinem Swatinem self-assigned this Aug 28, 2024
@codecov-notifications
Copy link

Codecov Report

Attention: Patch coverage is 96.87500% with 1 line in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files Patch % Lines
codecov_auth/admin.py 96.87% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link

codecov bot commented Aug 28, 2024

Codecov Report

Attention: Patch coverage is 96.87500% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.15%. Comparing base (80d64ad) to head (1307721).
Report is 13 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
codecov_auth/admin.py 96.87% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##               main       #778        +/-   ##
================================================
+ Coverage   96.13000   96.15000   +0.02000     
================================================
  Files           812        812                
  Lines         18385      18567       +182     
================================================
+ Hits          17675      17853       +178     
- Misses          710        714         +4     
Flag Coverage Δ
unit 91.97% <96.87%> (+0.03%) ⬆️
unit-latest-uploader 91.97% <96.87%> (+0.03%) ⬆️

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.

This adds a new function which finds all the "stale" `plan_activated_users` for a set of given `orgs`.
Users are considered stale if they don’t have any recent auth session or pull request.
Those users will then be removed from the `plan_activated_users`.
@Swatinem Swatinem force-pushed the swatinem/stale-user-cleanup branch from d3b5747 to 1307721 Compare August 28, 2024 11:43
Copy link
Contributor

@nora-codecov nora-codecov left a comment

Choose a reason for hiding this comment

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

great use of set math!

one note - I saw you added this on Account admin, not very many Orgs have Accounts, and I think potentially none of the enterprise orgs (that you mention in the description) would have Accounts. To get the effect you want, you would need to add the action to Owner admin.

@Swatinem
Copy link
Contributor Author

I saw you added this on Account admin, not very many Orgs have Accounts, and I think potentially none of the enterprise orgs (that you mention in the description) would have Accounts. To get the effect you want, you would need to add the action to Owner admin.

Thanks for this explanation. I will circle back on this and will implement that as a followup when needed.

@Swatinem Swatinem added this pull request to the merge queue Aug 30, 2024
Merged via the queue into main with commit b08bc0c Aug 30, 2024
17 of 18 checks passed
@Swatinem Swatinem deleted the swatinem/stale-user-cleanup branch August 30, 2024 10:05
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.

Add stale user cleanup functionality Stale user cleanup
2 participants