Skip to content

feat: add PUT /api/v2/users/:user-id/suspend endpoint #1154

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

Merged
merged 11 commits into from
Apr 26, 2022

Conversation

BrunoQuaresma
Copy link
Collaborator

Related to #662

@BrunoQuaresma BrunoQuaresma requested a review from a team April 25, 2022 19:11
@BrunoQuaresma BrunoQuaresma requested a review from a team as a code owner April 25, 2022 19:11
@BrunoQuaresma BrunoQuaresma self-assigned this Apr 25, 2022
@codecov
Copy link

codecov bot commented Apr 25, 2022

Codecov Report

Merging #1154 (cdebd55) into main (f9ce54a) will decrease coverage by 0.10%.
The diff coverage is 74.46%.

@@            Coverage Diff             @@
##             main    #1154      +/-   ##
==========================================
- Coverage   66.34%   66.23%   -0.11%     
==========================================
  Files         263      263              
  Lines       16615    16662      +47     
  Branches      156      156              
==========================================
+ Hits        11023    11036      +13     
- Misses       4452     4477      +25     
- Partials     1140     1149       +9     
Flag Coverage Δ
unittest-go-macos-latest 53.59% <36.17%> (-0.13%) ⬇️
unittest-go-postgres- 65.46% <74.46%> (-0.14%) ⬇️
unittest-go-ubuntu-latest 56.10% <36.17%> (+0.01%) ⬆️
unittest-go-windows-2022 53.16% <36.17%> (-0.01%) ⬇️
unittest-js 67.45% <ø> (ø)
Impacted Files Coverage Δ
coderd/audit/table.go 77.77% <ø> (ø)
codersdk/users.go 64.20% <45.45%> (-1.25%) ⬇️
coderd/users.go 63.27% <64.70%> (+0.04%) ⬆️
coderd/coderd.go 97.53% <100.00%> (+0.01%) ⬆️
coderd/database/queries.sql.go 81.66% <100.00%> (+0.21%) ⬆️
pty/start_other.go 64.70% <0.00%> (-23.53%) ⬇️
coderd/workspaceagents.go 55.59% <0.00%> (-3.84%) ⬇️
peer/channel.go 83.81% <0.00%> (-1.16%) ⬇️
agent/agent.go 68.43% <0.00%> (-0.71%) ⬇️
provisioner/terraform/provision.go 70.96% <0.00%> (-0.44%) ⬇️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f9ce54a...cdebd55. Read the comment docs.

@BrunoQuaresma
Copy link
Collaborator Author

Also related to #598

@BrunoQuaresma BrunoQuaresma mentioned this pull request Apr 25, 2022
17 tasks
Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

The change looks good to me (excepting the failed unit tests), but I'm confused as to why we're now creating a user_status column instead of a suspended column as was originally discussed here.

What kind of user statuses do we plan to have besides "active" and "suspended"?
If these are the only we currently have planned, would it be simpler to have a boolean column suspended with a default value of false?

@@ -28,12 +28,20 @@ type UsersRequest struct {
Offset int `json:"offset"`
}

type UserStatus string
Copy link
Member

Choose a reason for hiding this comment

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

Instead of UserStatus I'd be more in favor of @johnstcn's suggestion to use suspended as a boolean. Because we only have two statuses for now, it feels weird to make it generic.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

There is this conversation here https://codercom.slack.com/archives/C014JH42DBJ/p1650895472652489?thread_ts=1650895472.652489&cid=C014JH42DBJ but I'm good using both.

Ah, I missed parts of that thread. I'm fine either way honestly.

Copy link
Member

Choose a reason for hiding this comment

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

@kylecarbs @johnstcn I think we will have more statuses like dormant

Copy link
Member

Choose a reason for hiding this comment

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

Could a user be dormant and suspended?

Copy link
Member

Choose a reason for hiding this comment

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

@kylecarbs I believe the user would just be suspended.

-- Just my take --
Only active users count towards the licensed seats. A dormant user is "inactive" based on activity. A dormant user can reactive themselves by just being active again. (Maybe they have to do some more steps, idk).

A suspended user cannot even log in. Their account must be reactivated by an admin. The user has 0 input on this.

@BrunoQuaresma BrunoQuaresma merged commit 441ffd6 into main Apr 26, 2022
@BrunoQuaresma BrunoQuaresma deleted the bq/suspend-user branch April 26, 2022 14:00
@misskniss misskniss added this to the V2 Beta milestone May 15, 2022
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.

7 participants