-
Notifications
You must be signed in to change notification settings - Fork 956
fix: use system context for querying workspaces when deleting users (#19211) #19227
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: use system context for querying workspaces when deleting users (#19211) #19227
Conversation
…19211) Closes #19209. In `templates.go`, we do this to make sure we count ALL workspaces for a template before we try and delete that template: https://github.com/coder/coder/blob/dc598856e3be0926573dbbe2ec680e95a139093a/coderd/templates.go#L81-L99 However, we weren't doing the same when attempting to delete users, leading to the linked issue. We can solve the issue the same way as we do for templates.
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Thanks Ethan
cc: @stirby FYI |
Backport of #19211 to our ESR, v2.24, since this is a kind of bad (albeit rare) bug and very easy to fix.
Original PR
Closes #19209.
This fixes a bug where a user who has workspaces could be deleted, if the user doing the deleting couldn't view the workspace.
In
templates.go
, we do this to make sure we count ALL workspaces for a template before we try and delete that template:coder/coderd/templates.go
Lines 81 to 99 in dc59885
However, we weren't doing the same when attempting to delete users, leading to the linked issue. We can solve the issue the same way as we do for templates.