Separate active state from lock state in admin API

- Allow the admin API to deactivate a user without locking it, and to
  unlock a user without reactivating it.
- Make unlock-and-reactivate flows unset the "deactivated_at" timestamp.
- Revert adding an "unlock" parameter on `ReactivateUserJob`, as the
  option is used only by the admin API which doesn't use a job.
This commit is contained in:
Andrew Ferrazzutti
2025-07-14 14:20:32 -04:00
parent 63bb786b5d
commit 415e3a2555
11 changed files with 266 additions and 111 deletions

View File

@@ -1359,6 +1359,15 @@
"style": "simple"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeactivateUserRequest"
}
}
}
},
"responses": {
"200": {
"description": "User was deactivated",
@@ -1568,6 +1577,15 @@
"style": "simple"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UnlockUserRequest"
}
}
}
},
"responses": {
"200": {
"description": "User was unlocked",
@@ -3942,6 +3960,28 @@
}
}
},
"DeactivateUserRequest": {
"title": "JSON payload for the `POST /api/admin/v1/users/:id/deactivate` endpoint",
"type": "object",
"properties": {
"skip_lock": {
"description": "Whether to skip locking the user before deactivation.",
"default": false,
"type": "boolean"
}
}
},
"UnlockUserRequest": {
"title": "JSON payload for the `POST /api/admin/v1/users/:id/unlock` endpoint",
"type": "object",
"properties": {
"skip_reactivate": {
"description": "Whether to skip ensuring the user is active upon being unlocked.",
"default": false,
"type": "boolean"
}
}
},
"UserEmailFilter": {
"type": "object",
"properties": {