feat(graphql): add deleteOwner mutation for self-serve account deletion#1419
Open
thomasrockhu-codecov wants to merge 1 commit into
Open
feat(graphql): add deleteOwner mutation for self-serve account deletion#1419thomasrockhu-codecov wants to merge 1 commit into
thomasrockhu-codecov wants to merge 1 commit into
Conversation
Adds a `deleteOwner` GraphQL mutation so users can delete their own personal account or an organization they administer. The interactor authorizes via `ensure_is_admin` (covering both a user deleting themselves and an org admin) and routes the deletion through `TaskService().delete_owner`, the same code path the Django admin uses. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deleteOwnerGraphQL mutation so a user can delete their own personal account or an organization they administer.DeleteOwnerInteractorauthorizes withensure_is_admin(covers both a user deleting themselves and an org admin) and routes the deletion throughTaskService().delete_owner(ownerid=...)— the same code path the Django adminOwnerAdmin.delete_model/delete_querysetuse, so self-serve deletions are marked, obfuscated, and hard-deleted identically to staff-initiated ones.Details
New files:
codecov_auth/commands/owner/interactors/delete_owner.pygraphql_api/types/inputs/delete_owner.graphqlgraphql_api/types/mutation/delete_owner/(delete_owner.graphql,delete_owner.py,__init__.py)Registration:
codecov_auth/commands/owner/owner.py(delete_ownercommand)graphql_api/types/mutation/{mutation.graphql, mutation.py, __init__.py}Errors returned via the standard union:
UnauthenticatedError | UnauthorizedError | NotFoundError.Test plan
DeleteOwnerInteractorunit tests: unauthenticated →Unauthenticated; unknown owner →NotFound; non-admin/non-member →Unauthorized; personal account and org-admin paths callTaskService.delete_ownerwith the correctownerid.deleteOwnermutation tests: dispatch to command, unauthenticated error, personal-account deletion succeeds, deleting another owner is unauthorized.Made with Cursor