Skip to content

feat(scim): delete users on SCIM DELETE - #23

Merged
APaskowski merged 1 commit into
mainfrom
feat/scim-delete-user
Dec 4, 2026
Merged

APaskowski merged 1 commit into
mainfrom
feat/scim-delete-user

Conversation

@APaskowski

Copy link
Copy Markdown
Contributor

A SCIM DELETE only deactivated the user and answered 404 for users that were already inactive. Identity providers send DELETE when a person leaves, so the account stayed in Struudel.

Changes

  • DELETE /scim/v2/Users/<id> now deletes the user via delete_user_and_artifacts, the same function as the admin "Delete user" action. This also deletes the polls the user owns (required by polls.created_by_id … ondelete="RESTRICT") and, by cascade, the responses to those polls.
  • 404 only for unknown ids; inactive users are deleted as well.
  • README: SCIM section describes the behavior.
  • New integration tests in tests/integration/test_scim_routes.py.

Tests

  • New tests fail against main (2 of 3) and pass with the change.
  • Full suite: 135 passed (PostgreSQL 17 and Redis in containers); ruff check, ruff format --check, ty check clean.
  • End-to-end with an identity provider (authentik 2026.8.7) against a copy of a production database: a SCIM DELETE removed the user, one owned poll and its 82 responses; other users and polls were unaffected.

Note for reviewers

Deleting a leaving user's polls removes other people's answers to those polls as well. This is the intended behavior for us; if you prefer to keep polls, an alternative would be transferring ownership before deletion.

A SCIM DELETE only deactivated the user and answered 404 for users that
were already inactive. The IdP deletes users when they leave, so the
account stayed in Struudel.

- DELETE /scim/v2/Users/<id> removes the user and the polls they own,
  the same as the admin "Delete user" action; 404 only for unknown ids
- integration tests for the route
- README: describe the behavior

Assisted-by: claude-code:claude-opus-5-5
Signed-off-by: Andre Paskowski <andre.paskowski@netways.de>
@APaskowski
APaskowski merged commit 05de7e6 into main Dec 4, 2026
1 check passed
@APaskowski
APaskowski deleted the feat/scim-delete-user branch December 4, 2026 14:45
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.

1 participant