Skip to content

Conversation

@marius-mather
Copy link
Collaborator

@marius-mather marius-mather commented Jan 14, 2026

Description

AAI-607: soft-deletion should preserve memberships, so that after restoring, users can access platforms and bundles again immediately. (Users would regain access after their Auth0 roles were synced, but this could take ~30 minutes currently)

Changes

  • Update soft-delete logic so that memberships are kept when specified
  • Unit tests of delete/restore logic

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes admin soft-deletion to preserve user memberships to platforms and groups, allowing restored users to regain access immediately without waiting for Auth0 role synchronization (which could take ~30 minutes).

Changes:

  • Added a delete_memberships parameter (default True) to the BiocommonsUser.delete() method to control whether memberships are deleted
  • Updated admin_delete() to call delete() with delete_memberships=False to preserve memberships
  • Added comprehensive unit tests to verify the new behavior

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
db/models.py Added delete_memberships parameter to delete() method and updated admin_delete() to preserve memberships
tests/db/test_models.py Added three new tests: test_admin_delete, test_admin_restore, and test_admin_delete_preserves_memberships to verify the new functionality

Copy link
Contributor

@amandazhuyilan amandazhuyilan left a comment

Choose a reason for hiding this comment

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

Looks good - let's test

@marius-mather marius-mather merged commit 49147ef into main Jan 14, 2026
11 checks passed
@marius-mather marius-mather deleted the fix/delete-preserve-memberships branch January 14, 2026 04:40
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.

3 participants