Skip to content
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

Add ability to delete a user's information #6334

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

tsmock
Copy link
Contributor

@tsmock tsmock commented Apr 11, 2024

What type of PR is this? (check all applicable)

  • 🍕 Feature

Related Issue

Fixes #6002 (backend; frontend UI not done)

Describe this PR

This adds an API call (specifically, a DELETE to /users/<int:user_id> (specific user) and /users (users no longer on OSM)).

As much user-supplied information as possible is redacted, with the following exceptions:

  • Projects (specifically of note, project descriptions are not removed)
    • Projects are not reassigned either (maybe this should happen?)
  • Tasks (I believe this is would only have task modification times)
  • Interests (specifically, interests that the user created)
  • Licenses (just in case a license was required by a project)
  • User role (admins are downgraded to mappers, blocked users remain blocked)

Screenshots

N/A

Alternative Approaches Considered

Deleting user from database completely. Rejected partially due to complexity of figuring out what to do with mapped/validated tasks and user blocks.

Review Guide

For the code path that redacts users from the DB if the user deleted their account in OSM, user 535043 is known to no longer exist.

Sample psql command for user 535043:

INSERT INTO users VALUES (535043, 'some username', 0, 1, 0, 0, 0, null, 'foobar@example.com', '@meta', true, '@linkedin', '@twitter', NOW(), null, true, false, '@irc', 'London', 'United Kingdom', 'John Doe', '@skype', '@slack', 'ID', true, true, 'https://image.example/png.png', 0, 'a gender here', true, true, true);
$ curl -X DELETE -H 'Authorization: Token ${TOKEN}' localhost:5000/api/v2/users/

Further questions:
Is the OSM server admin team OK with us hitting /user/:id frequently?

EDIT: TomH pointed me at https://planet.openstreetmap.org/users_deleted/users_deleted.txt .

@tsmock tsmock force-pushed the feat/6002-delete-user-accounts branch 6 times, most recently from dc29a65 to 5e8e418 Compare April 16, 2024 20:46
@tsmock tsmock changed the title backend: Add ability to delete a user Add ability to delete a user's information Apr 17, 2024
@tsmock tsmock force-pushed the feat/6002-delete-user-accounts branch from c4c235e to 08b89be Compare May 2, 2024 15:45
tsmock added 4 commits May 7, 2024 07:35
Signed-off-by: Taylor Smock <tsmock@meta.com>
…hammering API

Signed-off-by: Taylor Smock <tsmock@meta.com>
Signed-off-by: Taylor Smock <tsmock@meta.com>
Of specific note, the background-image check passes prior to the
previous commit because two renders happen before the test continues.
With the new code, only one render happens.

This may have been a source of intermittent test failures in the past.

Signed-off-by: Taylor Smock <tsmock@meta.com>
@tsmock tsmock force-pushed the feat/6002-delete-user-accounts branch from 009b59c to f71048f Compare May 7, 2024 13:35
Copy link

sonarcloud bot commented May 7, 2024

Quality Gate Passed Quality Gate passed

Issues
5 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add function to delete user accounts
2 participants