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

CSV: Add field to set userId & localpart #96

Closed
nikzen opened this issue Nov 21, 2024 · 4 comments · Fixed by #100
Closed

CSV: Add field to set userId & localpart #96

nikzen opened this issue Nov 21, 2024 · 4 comments · Fixed by #100
Assignees

Comments

@nikzen
Copy link

nikzen commented Nov 21, 2024

Description

To migrate our remaining customers from LDAP to Zitadel, we need to reuse the localpart.

Solution

Add an extra field in the csv which is used to set the userId and localpart usermtadata.

@nikzen
Copy link
Author

nikzen commented Nov 25, 2024

The CSV import uses surname, prename & mail as input. This works for new users. If we want to migrate existing users, we also need to define the localpart as otherwise the user will lose access to their account.

We should add another field which is called localpart. Based on this field we will add the localpart as usermetadata and we are also able to set the userId to this attribute. (https://zitadel.com/docs/apis/resources/user_service_v2/user-service-add-human-user)

curl -L 'https://$CUSTOM-DOMAIN/v2/users/human' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
--data-raw '{
  "userId": "localpart-value",
  },
  "profile": {
    "givenName": "Minnie",
    "familyName": "Mouse",
    "displayName": "Minnie Mouse"
  },
  "email": {
    "email": "[email protected]",
    },

  "metadata": [
    {
      "key": "localpart",
      "value": "localpart-value"
    }
  ],
}'

@tlater-famedly
Copy link
Contributor

tlater-famedly commented Dec 2, 2024

"userId": "localpart-value",

Hm, we have this problem in general, but since syncing requires knowing the original sources' ID we'll need to come up with some clever way to match user IDs if they don't match whatever database we sync from in the future (assuming a different sync method ends up being used after an initial CSV sync).

If this is a use case we care about, we could write yet another migration tool that updates user IDs according to a new source we migrate to, under the assumption that email addresses have not changed.

@emgrav
Copy link
Member

emgrav commented Dec 2, 2024

For now we will reiterate and make even clearer that switching from one sync method to another is unsupported.

@emgrav emgrav assigned emgrav and unassigned emgrav Dec 2, 2024
@jannden
Copy link
Contributor

jannden commented Dec 5, 2024

Don't confuse with #75

This task talks about zitadel user IDs while #75 talks about external user IDs.

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

Successfully merging a pull request may close this issue.

4 participants