-
Notifications
You must be signed in to change notification settings - Fork 55
Allow skipping GDPR-erasure when deactivating a user through the admin API #4744
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
Conversation
This allows using the endpoint to deactivate a user without deleting it. TODO: make the request body optional.
Deploying matrix-authentication-service-docs with
|
Latest commit: |
49f2dae
|
Status: | ✅ Deploy successful! |
Preview URL: | https://b31f2644.matrix-authentication-service-docs.pages.dev |
Branch Preview URL: | https://af-rest-deactivate-erase-opt.matrix-authentication-service-docs.pages.dev |
The failure is due to the schema updater marking the request body of
In Is there a way to make schema generation aware of the body being optional? The reason I want it to be optional is to keep the endpoint backwards-compatible with its current form, which expects no body. EDIT: this is now handled by 1101dd9. |
// It should have scheduled a deactivation job for the user | ||
// XXX: we don't have a good way to look for the deactivation job | ||
let job: Json<serde_json::Value> = sqlx::query_scalar( | ||
"SELECT payload FROM queue_jobs WHERE queue_name = 'deactivate-user'", | ||
) | ||
.fetch_one(&pool) | ||
.await | ||
.expect("Deactivation job to be scheduled"); | ||
assert_eq!(job["user_id"], serde_json::json!(user.id)); | ||
assert_eq!(job["hs_erase"], serde_json::json!(erase.unwrap_or(true))); | ||
|
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.
I kept this in to check for the erase parameter on the job, as the response to GET /users
doesn't indicate whether the user was erased or not.
This makes it more intuitive for an empty request body to be equivalent to the option being set to false.
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.
Not 100% convinced by the negation (skip_erase vs. erase) but I guess it makes it backwards-compatible
Fixes #4742
This allows using the endpoint to deactivate a user without GDPR-erasing it