Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: add postgres triggers to remove deleted users from user_links#12117

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 27 commits intomainfromstevenmasley/deleted_user_links
Feb 20, 2024

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedFeb 13, 2024
edited
Loading

What this does

  • Removes ability toun-delete a user. We never exposed this outside the db layer, doing this to make that decision something that takes more thought than just changing an api param.
  • User_links should not longer exist for deleted users.

@EmyrkGraphite App
Copy link
MemberAuthor

Emyrk commentedFeb 13, 2024
edited
Loading

@EmyrkEmyrkforce-pushed thestevenmasley/linked_id_fix branch from6f09151 to24e767fCompareFebruary 13, 2024 15:48
@EmyrkEmyrkforce-pushed thestevenmasley/deleted_user_links branch from4113828 tob7fd329CompareFebruary 13, 2024 15:48
@EmyrkEmyrk changed the titlefix: add postgres triggers to keep user_links clear of deleted usersfix: add postgres triggers to remove deleted users from user_linksFeb 13, 2024
@EmyrkEmyrk marked this pull request as ready for reviewFebruary 13, 2024 17:01
@kylecarbs
Copy link
Member

Why are we removing the ability to undelete a user?

@Emyrk
Copy link
MemberAuthor

Emyrk commentedFeb 13, 2024
edited
Loading

@kylecarbs

Why are we removing the ability to undelete a user?

We never exposed this via the CLI or the API. It only exists in the DB query.

However, un-deleting a user is more work than just the query that I removed. It can now collide with existing users, theiruser_links were not correct, and now deleted.

Essentially undeleting a user can cause issues (if it can succeed at all), so we never supported it. And we should remove the query that will very likely fail in prod. I fear someone would just add a query param, use the existing query, merge it (because we do not test deleted users very much in tests). Then almost immediately it'll cause issues in an actual database.

@kylecarbs
Copy link
Member

I know we never supported it, but it feels odd to keep the soft delete and areal delete. Can we change it to completely do one or the other?

@Emyrk
Copy link
MemberAuthor

I know we never supported it, but it feels odd to keep the soft delete and areal delete. Can we change it to completely do one or the other?

We do not support hard deletes at all on most resources. For auditing purposes, we need to keep these objects around.

@kylecarbs
Copy link
Member

@Emyrk I'm confused why weshould then on users. It seems like a fork in the road. It seems better to either leave this and not permit undeleting a user (e.g. actually blocking it), or making it work instead of allowing it for a single resource type.

@Emyrk
Copy link
MemberAuthor

I do not totally follow.

The product feature set is unchanged. We previously only supported soft deleting users from the API. I just made the DB query reflect this, so nowyou cannot un-delete users even from a DB query. So just trying to prevent developer error.

Theuser_links cleanup is because a deleted user should not be able to authenticate into Coder anymore. This becomes problematic if this is allowed because then a single github user can have multiple accounts linked to it. Maybe this is ok? Just felt strange from a data POV, so I implemented this to clean it up in the same way we do api keys.

@EmyrkEmyrkforce-pushed thestevenmasley/linked_id_fix branch from24e767f tob0c3cbbCompareFebruary 13, 2024 18:07
Base automatically changed fromstevenmasley/linked_id_fix tomainFebruary 13, 2024 19:02
@EmyrkEmyrkforce-pushed thestevenmasley/deleted_user_links branch from56b8a0d toa54b652CompareFebruary 13, 2024 19:38
Copy link
Member

@kylecarbskylecarbs left a comment

Choose a reason for hiding this comment

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

Even though it is idiomatic with our data structure, I'm a bit nervous about having a term "soft delete" in one resource, even though I know we have it in others.

We've coined the termdeleted as a soft-delete already. And since we called itUpdateDeleted I feel like it's a bit more confusing to call thisSoftDelete now.

A few questions:

  1. Can we just fix this in the Go code? Do we need to have the triggers added? It seems harder to test, and more spread complexity.
  2. Is it alright if we continue to useUpdateDeleted instead ofSoftDelete? Does my rationale make sense in this context?

@Emyrk
Copy link
MemberAuthor

  1. Is it alright if we continue to useUpdateDeleted instead ofSoftDelete? Does my rationale make sense in this context?

How about I return the name toUpdateUserDeletedByID but always make it dodeleted = true? So there is no argument to ever revert the deleted state?

@kylecarbs
Copy link
Member

That sounds good to me!

Emyrk reacted with thumbs up emoji

@EmyrkEmyrk merged commit2dac342 intomainFeb 20, 2024
@EmyrkEmyrk deleted the stevenmasley/deleted_user_links branchFebruary 20, 2024 19:19
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsFeb 20, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@kylecarbskylecarbskylecarbs approved these changes

Assignees

@EmyrkEmyrk

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Emyrk@kylecarbs

[8]ページ先頭

©2009-2025 Movatter.jp