Uploaded image for project: 'Zapped: AcousticBrainz'
  1. Zapped: AcousticBrainz
  2. AB-395

Identify users by MB ids, instead of usernames

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • None
    • Server

      Because users can change their username in musicbrainz, we should use a more stable identifier instead of the username for users in acousticbrainz

      https://github.com/metabrainz/acousticbrainz-server/blob/f9afa4017c49b7d412b6557b68744d8fbbb2da07/db/user.py#L9-L16

      This was already implemented in ListenBrainz: https://github.com/metabrainz/listenbrainz-server/pull/415

          [AB-395] Identify users by MB ids, instead of usernames

          In addition to the code change that you mentioned we also need to add a new column musicbrainz_row_id to the database table that holds the users.

          Alastair Porter added a comment - In addition to the code change that you mentioned we also need to add a new column musicbrainz_row_id  to the database table that holds the users.

          Ganzagun added a comment -

          I like to confirm if I understood it correctly. 

          Firstly we have to make changes to user.py so that for a new user, it returns 3 fields: id (a local acousticbrainz row id), musicbrainz_id (the username), musicbrainz_row_id (the value of data['metabrainz_user_id'] in provider.py). 

          Also, for old users, we have to copy-paste the tool from ListenBrainz to get their particular musicbrainz_user_id.

          Please guide me if I made a mistake.

          Ganzagun added a comment - I like to confirm if I understood it correctly.  Firstly we have to make changes to user.py so that for a new user, it returns 3 fields: id (a local acousticbrainz row id), musicbrainz_id (the username), musicbrainz_row_id (the value of data ['metabrainz_user_id']  in provider.py).  Also, for old users, we have to copy-paste the tool from ListenBrainz to get their particular musicbrainz_user_id. Please guide me if I made a mistake.

          Alastair Porter added a comment - - edited

          In the current database we have 2 fields. id is a local identifier for the row used in acousticbrainz. musicbrainz_id is currently a user's musicbrainz login name. In test_user.py, we call user.create() with a musicbrainz_id (a username, e.g. fuzzy_dunlop), and the row id is returned (e.g. 1)

          The new user id is already returned by the MusicBrainz API when we do an oauth login. This value will be in the data object at https://github.com/metabrainz/acousticbrainz-server/blob/6d0099184f00843b3f9c13d94e27803e4d5a28dc/webserver/login/provider.py#L33

          Like the change in ListenBrainz, we should at the end have 3 fields: id (a local acousticbrainz row id), musicbrainz_id (the username), musicbrainz_row_id (the value of data['metabrainz_user_id'] in provider.py). Also, we should make sure that we have a tool to query musicbrainz and obtain these row ids for all users who have an account in AcousticBrainz. Again, these scripts exist in the ListenBrainz pull request linked in the main ticket. We can just copy them to AcousticBrainz, as they will only be needed temporarily.

          Alastair Porter added a comment - - edited In the current database we have 2 fields. id is a local identifier for the row used in acousticbrainz. musicbrainz_id is currently a user's musicbrainz login name. In test_user.py, we call user.create() with a musicbrainz_id (a username, e.g. fuzzy_dunlop), and the row id is returned (e.g. 1) The new user id is already returned by the MusicBrainz API when we do an oauth login. This value will be in the data object at  https://github.com/metabrainz/acousticbrainz-server/blob/6d0099184f00843b3f9c13d94e27803e4d5a28dc/webserver/login/provider.py#L33 Like the change in ListenBrainz, we should at the end have 3 fields: id (a local acousticbrainz row id), musicbrainz_id (the username), musicbrainz_row_id (the value of data ['metabrainz_user_id'] in provider.py). Also, we should make sure that we have a tool to query musicbrainz and obtain these row ids for all users who have an account in AcousticBrainz. Again, these scripts exist in the ListenBrainz pull request linked in the main ticket. We can just copy them to AcousticBrainz, as they will only be needed temporarily.

          Sweta Vooda added a comment -

          Does this mean that we need to update all the entries by replacing the username with a MiD and how to generate the unique id what features must the identifier carry?

          Also, there are two ids in "user" table ( "id" and "musicbrainz_id")  according to the test_user.py (unittest) file it is observed that both the fields take the same values(do they actually contain the same values). How to check what constraints and types are stored in each and see the schema of the tables.

          It would be helpful if somebody can elaborate on what has to be done, I am new to this organization and so little guidance could help me work on this issue.

          Sweta Vooda added a comment - Does this mean that we need to update all the entries by replacing the username with a MiD and how to generate the unique id what features must the identifier carry? Also, there are two ids in "user" table ( "id" and "musicbrainz_id")  according to the test_user.py (unittest) file it is observed that both the fields take the same values(do they actually contain the same values). How to check what constraints and types are stored in each and see the schema of the tables. It would be helpful if somebody can elaborate on what has to be done, I am new to this organization and so little guidance could help me work on this issue.

            Unassigned Unassigned
            alastairp Alastair Porter
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                Version Package