Skip to content

Fixed user synced attributes metadata after removing current provider

What does this MR do?

Fixes an error 500 after removing LDAP identity and also the LDAP config block from the gitlab configuration file.

Are there points in the code the reviewer needs to double check?

There are several errors associated to this MR:

  • The first one, the most obvious one, is the one that launches the error. This is raised because once we logged with the LDAP identity the user set his user_synced_attributes_metadata associated with that provider. Once we remove the LDAP identity, when we access the profile page it tries to ask the LDAP configuration for some information but, since we have removed the block, it raises an error saying that the setting server is not found.

  • The second one is, because of keeping the LDAP user_synced_attributes_metadata record associated with the user once we remove the identity. It is not needed and it will always block the user from updating their email, name and/or location (depending which attributes are synced). So, now, when we remove an identity, that record is removed.

  • The third one is related to those users that had done this migration manual (i.e: the reproduction procedure of the issue). We have to somehow clean those records for them because they will be stuck if their current omniauth configuration doesn't sync attributes. For example:

    • User logged in using LDAP identity
    • user_synced_attributes_metadata record is created to that user and the LDAP identity
    • User configures a new omniauth provider but without syncing any attribute
    • We remove the LDAP identity and log out
    • We sign in using the new omniauth provider and visit the profile page.
    • Although, we have set not to sync any attributes, some of them are read-only because the UI is using the stored user_synced_attributes_metadata from the LDAP identity.

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Fixes #37528 (closed)

Merge request reports