How to create User with multiple party ids

How to create User with multiple party ids

You can do this in daml script like this:

multi_party_user : Script UserId
multi_party_user = script do
  p <- allocateParty "userprimaryparty"
  a1 <- allocateParty "useractasparty1"
  a2 <- allocateParty "useractasparty2"
  r1 <- allocateParty "userreadasparty1"
  r2 <- allocateParty "userreadasparty2"

  -- Set up a user
  userId <- validateUserId "myuser"
  createUser (User userId (Some p)) [CanActAs p, CanActAs a1, CanActAs a2, CanReadAs r1, CanReadAs r2]

  return userId

Via the API just use the Party and User Management services to take the same actions.

1 Like

Do you have some sample codes how to do it via the API ?

There’s only one paryId in the navigator.

Navigator only shows you the list of users and allows you to interact with the primary party of each user. At this point, Navigator does not allow you to interact with other parties that a user might have claims for.

If you want to use navigator for other parties, then create separate users that have those parties set as their primary party.