BiologicalRecordsCentre / UKBMS-online

Issue tracking for UKBMS online recording site
2 stars 0 forks source link

Unable to approve some user accounts #275

Closed IanMiddlebrook closed 2 years ago

IanMiddlebrook commented 2 years ago

Hi @DavidRoy @BirenRathod @JimBacon

Sometimes when we try to approve a new User account on the UKBMS, we get this message:

image

There are never any websites in the dropdown list, so we are unable to resolve the issue, and unable to approve their account.

Do we know which websites are likely to be causing this problem, and is there any way to by-pass this so that we can approve the User and they can start entering their transect data?

Thanks, Ian

JimBacon commented 2 years ago

Hi Ian,

As a bit of background, when a user registers with a website connected to our Indicia warehouse, a check is done to see if they have already registered with it via another website. There are lots of other websites. The aim is to avoid creating multiple accounts on the warehouse for the same person. See https://indicia-docs.readthedocs.io/en/latest/developing/web-services/user-identifiers.html for more detail.

For Rosie I can see we seem to have two user IDs linked to one email. This may be a little bit of mess to clear up on the warehouse and that might make this particular problem go away. I will look at that a bit more in a moment.

In general, though, it is Rosie who needs to be presented with this dialog, not you, as you are not able to answer the question that is being posed. I guess the warehouse account is not being created until you approve the request which would explain why you see the message. I don't know why the list of websites is empty.

I wonder if any other website has made this workflow operate successfully.

JimBacon commented 2 years ago

To remove the duplication from the warehouse, after checking there were no samples, occurrences or locations for this user id, I ran the queries

update users
set deleted = true, updated_on = now(), updated_by_id = 2
where id = 94638;

delete from users_websites
where user_id = 94638;

update user_identifiers
set deleted = true, updated_on = now(), updated_by_id = 2
where user_id = 94638;

I was then able to unblock the account on ukbms.org. @IanMiddlebrook if you need to update any other aspects of the new account, please do so now

IanMiddlebrook commented 2 years ago

Thanks @JimBacon

JimBacon commented 2 years ago

We resolved this specific case and updating the database was probably the correct resolution in this instance. A lot of work has been done to try to prevent further duplicate users from arising but I noticed we still have about 450. When it happens again, raise another issue and refer back to this one, if possible. Note to self: I could simply delete the users_websites record because it was identical for both users. There was no need to merge.