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

LB-354: Musicbrainz delete endpoint #409

Merged
merged 9 commits into from Jun 25, 2018

Conversation

paramsingh
Copy link
Collaborator

This PR adds the MusicBrainz delete-user endpoint as specified by https://tickets.metabrainz.org/browse/MBS-9680.

@paramsingh
Copy link
Collaborator Author

@mwiencek, please take a look at the last commit (ba533f8) if you get the time.

@mayhem
Copy link
Member

mayhem commented May 16, 2018

Rebase, please.

@paramsingh paramsingh force-pushed the musicbrainz-delete-endpoint branch from 75ee6f1 to 7366137 Compare May 16, 2018 12:27
Copy link
Member

@mayhem mayhem left a comment

Choose a reason for hiding this comment

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

This looks good to me -- one question -- what setup do we need to create the user that can delete users? Should there be a script for that?

try:
r.raise_for_status()
except HTTPError:
raise Unauthorized('Not authorized to use this view')
Copy link
Member

Choose a reason for hiding this comment

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

I like how you give no useful info the caller. Well done!

Copy link
Member

Choose a reason for hiding this comment

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

https://httpstatuses.com/401 - Unauthorized requires a "WWW-Authenticate" header. Does this get set internally?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@paramsingh
Copy link
Collaborator Author

From the ticket, it seemed like the creation of the UserDeleter account would be handled in MusicBrainz.

@@ -120,6 +124,35 @@ def current_status():
)


@index_bp.route('/delete-user/<musicbrainz_id>')
def mb_user_deleter(musicbrainz_id):
Copy link
Member

Choose a reason for hiding this comment

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

We decided in last week's meeting that storing the editor IDs in LB et al. is the way to go, so MB will actually send the editor row ID here and not the name. (Not sure if you've already started updating it to expect that, or if musicbrainz_id is actually the user name here.)



def _authorize_mb_user_deleter(auth_token):
query_url = 'https://musicbrainz.org/oauth2/userinfo'
Copy link
Member

Choose a reason for hiding this comment

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

(I mentioned this in the BookBrainz PR too, but) it'd be nice if the MusicBrainz server URL were configurable, so we don't have to hand-edit source files when testing this locally (or against test.mb, say). Not just here, but for OAuth logins and all other references too.

@mwiencek
Copy link
Member

This looks good to me -- one question -- what setup do we need to create the user that can delete users? Should there be a script for that?

I just created the user we need manually and documented it here: https://github.com/metabrainz/syswiki/blob/master/MusicBrainzUserDeleter.md

@paramsingh
Copy link
Collaborator Author

This should be ready for review again, I've rebased, updated it to expect MusicBrainz Row IDs and added more tests.

@paramsingh paramsingh changed the base branch from production to master June 21, 2018 21:26
@mayhem
Copy link
Member

mayhem commented Jun 25, 2018

OK, I think this is ready to merge.

@paramsingh paramsingh merged commit 76e7039 into metabrainz:master Jun 25, 2018
@paramsingh paramsingh deleted the musicbrainz-delete-endpoint branch June 25, 2018 16:30
@marc2k3
Copy link

marc2k3 commented Nov 23, 2020

Is this working? I deleted my MEB account ages ago yet my LB profile is still present...

https://listenbrainz.org/user/marc2k3

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