I have the need to migrate one, possibly more, users from GitLab (Keycloak) back to simple user name/email authentication.
Looking at the documentation here mmctl command line tool — Mattermost documentation it seems like this path isn’t supported?
Means the only way available is directly modifying the user table?
Edit:
There was some time pressure so I went ahead with SQL, sharing my approach for the potential benefit of others.
This command… sudo docker exec -it --user postgres mattermost-db psql -d mattermost -c "update users set authdata='',authservice='',password='' where username like('MyUsersName');"
… followed by a password reset did the trick.
Obviously, if you don’t use docker you can skip all the docker exec… stuff.
i went into my SQL data base and updated the information to " ". i now get an error saying, There is already an account associated with that email address using a sign in method other than gitlab. please sign in using . im wanting to switch from saml to gitlab. any insight to this?
That’s a different scenario i think. What I wrote higher up is switching from 3rd party to a Mattermost native logon.
What you seem to need is from third party (saml) to another third party (gitlab).
I never tried that but would expect that the authdata and authservice fields should not be empty but contain different values.
I think my approach to this would be to create a new user using gitlab and compare the sql record with an existing saml user to get an idea what field needs to be changed to what.
I guess it’s obvious but just in case, make sure you got a good copy of the database before making any changes
yeah we tried that as well and the saml data seems to be sticky and wont allow us to change the auth method at all. even when we delete the fields you listed above it still gives an error saying the account is linked with saml
Hm, in that case the db structure may have changed and some of the authentication data is held in a different table? But still, I would expect something in the user table to signify that a user is SAML and not native or gitlab?
we managed to get it to work, setting auth_data field in postgres is the only one it cares about when switching users. im very new to postgres, its saying the field is unique and we cannot set mutliple users to the value of auth_data=“”. did you run into this issues when setting your users auth data to the same value?
I think you are dealing with an index which stretches over multiple fields, the combination field1+field2 needs to be unique.
I won’t be at my desk today hence can only guess it’s the field which defines the type of authentication + user id.
And yes, I can vaguely remember running into the same error. But didn’t have to touch the db since I opened this thread.
This index situation would be the same on any database by the way…